Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Id inheritance

 
Paco GarcĂ­a
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two entities (Item and CostItem) which share the same table (ITEMS).
CostItem is a subclass inherited from Item.
When the user creates an Item, he must be able to provide his own item code (id column) without restrictions, but when the user creates a CostItem, I don't want him to indicate this code, instead this code must be "read" from a database sequence.

This two object are declared as shown:




Does anynone know how to acomplish this automatic id generation.

Thank you very much
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic