-->
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.  [ 3 posts ] 
Author Message
 Post subject: Mapping Class hierarchy in multiple files
PostPosted: Fri Mar 09, 2007 3:04 pm 
Newbie

Joined: Fri Mar 09, 2007 2:57 pm
Posts: 3
Location: Cold Canada
Hi,

When you have a class design in which every class inherits from a common abstract super class how does one go about defining the corresponding HBM XML? In our database each concrete class is represented as a separate table. I was hoping to use the union-subclass strategy.

All examples I've come across seem to imply that all hibernate mappings for the class hierarchy are required to be in one file. Is this the case?

Hope you can help.

Mucho Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 09, 2007 3:40 pm 
Regular
Regular

Joined: Wed Dec 07, 2005 4:19 pm
Posts: 53
I wish Hibernate configuration files supported XML includes.

I had to put a hack around configuration loads, using an InputStream which interprets my non-standard #include syntax (but now my XML editors complain about it, as it is not DTD-kosher).

In my case, I am using such includes to "package" groups of mapping files (roughly corresponding to Java class packages), so that individual, application level configuration files do not have to change whenever one of the packages adds a new object.
But it can be used to include a repeated mapping (base class) portions (we do not have too many of those).

{don't forget to rate IF this posting helps}.
Martin.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 09, 2007 6:16 pm 
Newbie

Joined: Fri Mar 09, 2007 6:12 pm
Posts: 2
Hi Mohamed,

You can in fact do what you are proposing. All you need to do is put the "extends" attribute on the "union-subclass" tag in the child's mapping file.

Hope that helps.

PS. Keep digging that dirt.


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