• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to generate User Defined Primary Key in Hibernate

 
Sreenivas Reddy Tatikunta
Greenhorn
Posts: 24
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

How to generate following primary keys using Hibernate Algorithms.

Primary keys are : 000001,000002,.....000100,000101,..................001000,001001.............N

Please guide how to generate above primary key using hibernate and which algorithm can be use.

Thanks in Advance,

Regards,
Sreenivas Reddy.T
 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to generate the ids yourself then you have to implement the org.hibernate.id.IdentifierGenerator which defines the logic. See the documentation for more details.
 
Sreenivas Reddy Tatikunta
Greenhorn
Posts: 24
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

Can any one please provide a sample example.


Thanks & Regards
Sreenivas Reddy.T
 
Paul Clapham
Sheriff
Posts: 21551
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What was wrong with the example in the page which Vijitha Kumara linked to?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic