File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Inheriting properties from superclass Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Inheriting properties from superclass" Watch "Inheriting properties from superclass" New topic
Author

Inheriting properties from superclass

Fane Preda
Greenhorn

Joined: Dec 06, 2005
Posts: 5
Hello,

In my model I have a series of classes that extend an abstract class named Resource and I want those classes to have mutually exclusive id's (the id being their primary key) because I want to be able to reference any Resource by unique id. I created a sequence in the database (PostgreSQL 8) named "SEQUENCE_GLOBAL_RESOURCE_ID". My code like this:





Example of entity which extends Resource:





Now if I retrieve an Organization, the instance I get has all the fields correct (as in the database) except for id which is 0! Does anyone have any idea why this is happening?

Thanks.
 
jQuery in Action, 2nd edition
 
subject: Inheriting properties from superclass
 
Similar Threads
Help with JPA
Identity issue for EJB3.0 Entity along with Hibernate HBM configuration
Unable to define/override @Id(s) on a subclass; which classes i have to solve?
EJB3 : override column mapping
Unable to define/override @Version on a subclass