Hi,
I have following modeling problem:
I have a java class, let's name it "class A", with 3 attributes (attr1, attr2 and attr3). This class is represented by 2 tables in the database: tableX and tableY. TableX and TableY have each 3 fields. TableX has field1X, field2X and field3X. TableY has field1Y, field2Y and field3Y. I'd like to have class A to hold the information from the 3 fields coming from tableY and tableX. Is there a way to do it without subclassing class A?
The name of the fields are different on tableX and tableY but they can be "stored" by class A because they hold the same information and have the same type. @AttrbuteOverrides apparently could do the job but I'd have to subclass class A, wouldn't I?
And of course.. I cannot change the DB.
My real problem is a bit more complicated than that actually. I have a whole class model (about 10 classes) with the same problem and they are all connected thru some sort of relationship.
I'm using Hibernate 3.4 annotations.
Thanks for any ideas!
Ken
|