-->
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.  [ 6 posts ] 
Author Message
 Post subject: Cross references in mapping files
PostPosted: Mon Oct 10, 2005 6:37 am 
Newbie

Joined: Mon Oct 10, 2005 6:11 am
Posts: 10
Hi!

Here is my problem:

I've two eclipse projects; the first contains abstract entities, that will be used in multiply projects. The second is my current project, which contains the first as a reference, so i can use those abstract entities in a production application.

I'm using the table per subclass inheritance strategy, to map my entities to database. The problem with this solution is that i have to map my inheritance hierarchies in one hbm.xml.
There are inheritance hierarchies which starts in my first project, and ends in my second. Mapping files are located in my abstract project, so it contains information about my current project, but it should not do.

Thanks for any help.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 10, 2005 12:42 pm 
Newbie

Joined: Mon Oct 10, 2005 6:11 am
Posts: 10
up


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 10, 2005 4:44 pm 
Beginner
Beginner

Joined: Wed Sep 21, 2005 11:52 am
Posts: 43
If I understand you correctly, you are trying to avoid references from the abstract project to the concrete project and use the table per subclass inheritance mapping.

According to the Hibernate docs you should be able to have separate mapping files for your subclasses that use <joined-subclass> as a top level element (i.e. instead of class). These can reside in your concrete project. They will need to specify the class that they extend of course since they are not lexically inside a class definition.

I did this using <subclass> for the table per class hierarchy strategy.

Good luck.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 9:14 am 
Newbie

Joined: Mon Oct 10, 2005 6:11 am
Posts: 10
Thanks, it works.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 10:45 am 
Regular
Regular

Joined: Thu Feb 17, 2005 1:58 am
Posts: 63
lkline wrote:
If I understand you correctly, you are trying to avoid references from the abstract project to the concrete project and use the table per subclass inheritance mapping.

According to the Hibernate docs you should be able to have separate mapping files for your subclasses that use <joined-subclass> as a top level element (i.e. instead of class). These can reside in your concrete project. They will need to specify the class that they extend of course since they are not lexically inside a class definition.

I did this using <subclass> for the table per class hierarchy strategy.

Good luck.


Can you point me to the place in the docs? I would like to map class per table and I would have each class mapping in a separate file. I rather not nest the entire hierarchy in one file.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 11:27 am 
Beginner
Beginner

Joined: Wed Sep 21, 2005 11:52 am
Posts: 43
hiberdude wrote:
lkline wrote:
If I understand you correctly, you are trying to avoid references from the abstract project to the concrete project and use the table per subclass inheritance mapping.

According to the Hibernate docs you should be able to have separate mapping files for your subclasses that use <joined-subclass> as a top level element (i.e. instead of class). These can reside in your concrete project. They will need to specify the class that they extend of course since they are not lexically inside a class definition.

I did this using <subclass> for the table per class hierarchy strategy.

Good luck.


Can you point me to the place in the docs? I would like to map class per table and I would have each class mapping in a separate file. I rather not nest the entire hierarchy in one file.


See section 5.1.14 in the pdf of the reference document. It's also in the book Hibernate in Action in section 3.6.4. It's quite straightforward. Just put your subclass mapping in a separate file and add the attribute 'extends' to it. E.g.


Code:
<subclass name="foo.bar.MySubclass" extends="foo.bar.MySuperclass">
...
</subclass>


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