Solved

generator to native

Posted on 2011-03-24
7
302 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:
gurvinder372 earned 250 total points
ID: 35212608
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 35212611
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 35213428
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 20

Assisted Solution

by:Sathish David Kumar N
Sathish David  Kumar N earned 250 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB Script to add site to Java Exception List 4 81
HSSFWorkbook cannot be resolved error 10 74
xampp tool 12 52
login jsp example 24 51
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

825 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