generator to native


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.
Who is Participating?
Gurvinder Pal SinghCommented:
Sathish David Kumar NArchitectCommented:
7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

Sathish David Kumar NConnect With a Mentor ArchitectCommented:
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.
gudii9Author Commented:
>>>Remember, if you haven't chosen any generator you have supply it by yourself i.e. assigned is a default generator.


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
Sathish David Kumar NArchitectCommented:
>>>>>>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.
gudii9Author Commented:
any good video tutorials, online trainings on these these intricate concepts. please advise
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.