• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

identity columns as generators

 
satish bodas
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,
Am trying to read and understand JPA and to generate primary keys one option given is :: "Identity columns as generators "

Is this applicable to only specific few databases ?
Is this applicable for Oracle too ?

Thanks ,
~satish
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is only applicable to some relation databases. Most RDBMSs have a simmilar concept however. Oracle does not use them, it provides sequences instead.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To be safe, you can always specify the unique identifier generation strategy to auto. That way, it will use Identity on MySQL or Derby Databases, and then go to Sequence on Oracle.



Using a Sequence sometimes requires a bit more information than simple Identity:



I have a little tutorial that deals with implementing the various Hibernate GenerationTypes if you're interested:

How to Use the Hibernate Primary Key Generation Types
[ June 25, 2008: Message edited by: Cameron Wallace McKenzie ]
 
satish bodas
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul and Cameron for providing the details .

~satish
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic