-->
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.  [ 5 posts ] 
Author Message
 Post subject: How to avoid redundancy in table-per-concrete-class mapping?
PostPosted: Sat Mar 06, 2004 5:37 am 
Newbie

Joined: Thu Mar 04, 2004 4:43 pm
Posts: 5
Please look at the following example.

class abstract Device

class Computer extends Device
class MobilePhone extends Device

Device has a few fields common to all Devices, say price and owner. I like to use a table-per-concrete-class mapping and I wish to have all information about price and owner in one *.hbm.xml file. But as far as I understood the documentation there would be no file Device.hbm.xml. I have to put the same information in Computer.hbm.xml and MobilePhone.hbm.xml.

How can I avoid this redundancy?

best regards
Jan


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 06, 2004 12:19 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Use xdoclet.
There is no way do do that in hbm.xml

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 08, 2004 3:46 am 
Newbie

Joined: Thu Mar 04, 2004 4:43 pm
Posts: 5
emmanuel wrote:
Use xdoclet.
There is no way do do that in hbm.xml

Thank you for your answer. I will read the xDoclet documentation. This will be a solution for my problem.

But having something which I can express using xDoclet but not using your *.hbm.xml files is a little bit confusing for me. Would it not be good giving the same power to xDoclet and *.hbm.xml? If there would be an additional *.hbm.xml file for the root class containing all the properties in common to all subclasses Hibernate would have all information needed to make the mapping using Java reflection. And there would be no redundancy in the *.hbm.xml files of the subclasses. May be this could be a feature in a future release? What do you think about this proposal?

Best regards Jan


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 08, 2004 8:51 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
xdoclet generate hbm, so it can duplicate info when needed.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 08, 2004 9:55 am 
Newbie

Joined: Thu Mar 04, 2004 4:43 pm
Posts: 5
emmanuel wrote:
xdoclet generate hbm, so it can duplicate info when needed.


Sorry if my point of view was not quite clear in my last posting. I knew that xcoclet generates hbm. I think even if I write the hbm files per hand without using xdoclet it should be possible to do this without code duplication.

Best regards Jan


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.