-->
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.  [ 2 posts ] 
Author Message
 Post subject: Reverse Engineering Hibernate inheritance
PostPosted: Mon May 19, 2014 5:50 am 
Newbie

Joined: Mon May 19, 2014 5:24 am
Posts: 1
Hi,
i'm a student and i need help for Reverse Engineering with inheritance.

Premise:

Hibernate supports the three basic inheritance mapping strategies:

table per class hierarchy
table per subclass
table per concrete class

My problem:

With the Reverse Engineering of Hibernate (via the tools provided by Eclipse), I would like to generate both the mapping files that classes from an existing database.
In the case of inheritance, things get more complex. I wish everything was automatic.
I'm trying to deal with the three cases separately:


table for class hierarchy

In this case, I have a table for the entire hierarchy. The ideal would be to split the table into multiple classes, but neither it nor the Strategy and Reveng.xml allows me to do this. How can I fix?

table for subclass

In this case I used the meta file reveng.xml (in particular, extends, and the exclude to exclude attributes that are foreign keys). Once generated classes I change back the xml file by entering the tag <joined-subclass>. But there is a different way easier and more automatic?


table for concrete class

In this case I used the meta file reveng.xml (in particular, extends, and to exclude the attributes repeated in child classes). Once generated classes I change back the xml file by entering the tag <union-subclass>. But there is a different way easier and more automatic?
However, there remains the problem related to the case of abstract base class that does not have a corresponding table. How can I fix?


Top
 Profile  
 
 Post subject: Re: Reverse Engineering Hibernate inheritance
PostPosted: Tue Sep 09, 2014 7:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
No, you cannot automatically do mapping of hiearchies based on the metadata available from your tables.

Generally my thinking is that if your model fits hiearchy mapping of tables then you are better of having the mapping done in hibernate mapping files rather than some limited setup possible in reveng.xml.

_________________
Max
Don't forget to rate


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