This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes @TableGenerator: how to override in subclass? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "@TableGenerator: how to override in subclass?" Watch "@TableGenerator: how to override in subclass?" New topic
Author

@TableGenerator: how to override in subclass?

Vincenzo Turco
Greenhorn

Joined: May 15, 2009
Posts: 12
Hi developers,
I am facing a problem I have found no solution to yet surfing the web.
Any help would be appreciated.
It's about JPA 1.0 persistence and how pKey generation is handled when class hierarchies and mappedsuperclasses are involved.

My Base Class is like:


However I found out that defining the @Id on the base class leads to all persistent subclasses sharing the same row in the tableGenerator and thus the same counter.
I would like to have separate tableGenerator rows (i.e. counters) for the generation of pKeys in each subclass
How can this behavior be achieved?

Thanks, regards
Vincenzo


SCJP6 (90%), SCDJWS (74%), SCBCD (83%), SCEA next? ;)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @TableGenerator: how to override in subclass?
 
Similar Threads
Doubts in Hibernate key generators.
Overriding??!
Doubt on TableGenerator
TableGenerator
JPA 1.0 - How to override @TableGenerator in subclass