Solved

generator to native

Posted on 2011-03-24
7
305 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Cloud Training Guides

FREE GUIDES: In-depth and hand-crafted Linux, AWS, OpenStack, DevOps, Azure, and Cloud training guides created by Linux Academy instructors and the community.

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
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…
Suggested Courses

631 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