?
Solved

<generator class="native"/> doubt

Posted on 2008-10-09
2
Medium Priority
?
6,799 Views
Last Modified: 2013-11-24
what is the difference between

<generator class="native"/>
  and
<generator class="assigned"/>

in hibernate
0
Comment
Question by:priyapratheep
[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
2 Comments
 
LVL 9

Accepted Solution

by:
darkapple earned 1500 total points
ID: 22684953
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

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
A solution for Fortify Path Manipulation.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

800 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