• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate 3 Set Primary Key with code

 
Adrian Enns
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to set the primary key of a persistent object manually?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use an "assigned" generator class for your primary key mapping.
 
Adrian Enns
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul, can you give me an example, I'm new to this technology.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure:
 
Adrian Enns
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul, got it working. I appreciate it!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic