-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: inheritance question
PostPosted: Wed Jun 29, 2005 10:20 pm 
Newbie

Joined: Wed Apr 27, 2005 5:25 pm
Posts: 2
Given a database table with a large number of columns, I'd like to have 2 java classes for this table...

Class A would only map to a few of the table's columns and will be used as a "lightweight" version of the table, i.e. lower serialization penalty.

Class B would extend class A and refer to all the fields. Only instances of class B would ever be created/saved.

My initial attempt of mapping both classes to the same table (each with a regular <class> mapping) produced a problem. When trying to get(...) an instance of class B, I'd get back class A instead even though class B's class object was passed in. I cannot modify the table, and none of the Hibernate inheritance strategies I read about seem to apply... is what I want to do possible in Hibernate 2.x+?

Thanks ahead of time for any thoughts.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 30, 2005 9:57 am 
Newbie

Joined: Thu Jun 30, 2005 9:45 am
Posts: 3
i wanted to do a similar thing, but hibernate is not sophisticated enough yet to do that... ended up having to redesign stuff >:(


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 30, 2005 10:04 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Thats why there is a pattern for exactly this in the Wiki for 2 years...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 30, 2005 10:33 am 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
So others don't have to dig around for it in the Wiki:

Lightweight Class


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.