I need sample code about access auto generated primary key in hibernate.plz help me.
when you generate your hbm file ,your auto generated primary key is like this:
<id name="id" type="long"> <column name="ID" /> <generator class="native" /></id>
In Hibernate mapping fileusing this code we can automatically generate the primary keys
<id name="emp number" type="integer"><column name="emp number"/><generator class="increment"/></id>
There are some algorithms that can be used for PK generation, please have a look at:www.hibernate.org/.../mapping.htmlSome of them can be used on specific databases, while others like 'increment' can be used for all databases. There are some performance considerations with this approach.