-->
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.  [ 8 posts ] 
Author Message
 Post subject: Hibernate Tools - annotation - InheritanceType.JOINED
PostPosted: Tue Oct 04, 2005 7:39 am 
Newbie

Joined: Thu Sep 29, 2005 4:30 am
Posts: 7
Hibernate version:
3.1 beta3
hibernate-tools 3.1 CVS version

Is it possible to map inheritance with tools.
(in my case InheritanceType.JOINED)
I am looking for something like
Code:
@Entity()
@Inheritance(strategy=InheritanceType.JOINED )
public class Boat implements Serializable { ... }

@Entity()
public class Ferry extends Boat { ... }

With build.xml having
Code:
<hbm2java ejb3="true" generics="true" templatespath="${basedir}/myTemplates" />


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 04, 2005 10:19 am 
Newbie

Joined: Thu Sep 29, 2005 4:30 am
Posts: 7
How to generate
Code:
@Entity()
public class Trainer {
    @OneToMany
    @JoinTable(
            table=@Table(name="TrainedMonkeys"),
            joinColumns = { @JoinColumn( name="trainer_id") },
            inverseJoinColumns = @JoinColumn( name="monkey_id")
    )

    public Set<Monkey> getTrainedMonkeys() {
    ...
}

@Entity
public class Monkey {
    ... //no bidir
}


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 04, 2005 12:02 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
What do you mean "support inheritance" ?

If you mean from reverse engineering then no since we dont have enough information from a jdbc schema to deduce inheritance.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 05, 2005 1:53 am 
Newbie

Joined: Thu Sep 29, 2005 4:30 am
Posts: 7
Yes I mean for reverse engineering.
I thought that it can be defined in hibernate.reveng.xml file or something like join.xml.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 05, 2005 3:18 am 
Newbie

Joined: Thu Sep 29, 2005 4:30 am
Posts: 7
And for many-to-many association, the association tables could be declared in hibernate.manytomany.xml so hibernateTools could know what shoud be maded.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 05, 2005 3:27 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
neither is possible and if they were going to be specified it should be reveng.xml which controls JDBCBinder/JDBCReader's interpretatin of the jdbc model into ORM model

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 12:23 am 
Regular
Regular

Joined: Thu Feb 17, 2005 1:58 am
Posts: 63
max wrote:
neither is possible and if they were going to be specified it should be reveng.xml which controls JDBCBinder/JDBCReader's interpretatin of the jdbc model into ORM model


How about adding something like "Vehicle:Car;Vehicle:Truck;Vehicle:Tank;Vehicle:Car:SportsCar" and the tool can deduce the tables Vehicle, Car, Truck, SportsCar, and Tank should be in a inheritance hierarchy. Then a switch to determine the type of inheritance mapping type.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 12:52 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Code:
<table name="Car" extends="vehicle">


might be ok - not a priority though....

_________________
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.  [ 8 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.