Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

generator to native

Posted on 2011-03-24
7
Medium Priority
?
307 Views
Last Modified: 2012-05-11
Hi,

I would like to know what is generator setting to native in hibernate. Where and how and why to use it. How to know hibernate picks either identity, sequence or hilo algorithm. Any ideas, resources, links, sample code highly appreciated. thanks in advance.
0
Comment
Question by:gudii9
  • 3
  • 2
  • 2
7 Comments
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 1000 total points
ID: 35212608
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 35212611
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 35213428
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 20

Assisted Solution

by:Sathish David Kumar N
Sathish David  Kumar N earned 1000 total points
ID: 35213560
native is  used whenever you have your underlying database handling the primary key generation. Hibernate choose itself a best way to generate id according to database it is interacting with

whenever you are confused which generator to choose, give a try with native.

use assigned whenever you have own style of generating ids. Sometimes whenever i've random data in my table and hibernate is unable to identify pattern for generating next id, i use assigned so that i can manually generate my ids and supply it  for persistence.

Remember, if you haven't chosen any generator you have supply it by yourself i.e. assigned is a default generator.
0
 
LVL 7

Author Comment

by:gudii9
ID: 35353673
>>>Remember, if you haven't chosen any generator you have supply it by yourself i.e. assigned is a default generator.

>>>http://www.roseindia.net/hibernate/hibernateidgeneratorelement.shtml

I do not see explanation of assigned. Can we use assigned with oracle. I only see squence with oracle database. what this assigned will do by default and what sequence do. please advise
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 35356641
>>>>>>its there

assigned       lets the application to assign an identifier to the object before save() is called. This is the default strategy if no <generator> element is specified.
0
 
LVL 7

Author Comment

by:gudii9
ID: 35462991
any good video tutorials, online trainings on these these intricate concepts. please advise
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question