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.  [ 4 posts ] 
Author Message
 Post subject: [Hibernate Tools] Reverse ing - class hierarchy
PostPosted: Mon Jul 30, 2007 2:08 pm 
Newbie

Joined: Mon Jul 30, 2007 1:59 pm
Posts: 6
Hello,

I would like to use Hibernate Tools for a project and I need to generate the HBM files and java files from an existing Oracle 10g database.

The both generations work, but the HBM files desn't contain any information about the hierarchy. See the SQL code below :
Code:
create table Employe (
    ID integer not null,
    NOM varchar(20)
);
alter table Employe
    add constraint Employe_pk primary key (ID);

create table Note (
    ID integer not null,
    valeur varchar(20)
);
alter table Note
    add constraint Note_pk primary key (ID);

create table Ouvrier (
    EMPLOYE_ID integer not null,
    SERVICE varchar(20),
    NOTE_ID integer not null
);
alter table Ouvrier
    add constraint Ouvrier_pk primary key (EMPLOYE_ID);
alter table Ouvrier
    add constraint Employe_fk foreign key (EMPLOYE_ID) references Employe (ID);
alter table Ouvrier
    add constraint Note_fk foreign key (NOTE_ID) references NOTE (ID);


Here I would like to have a class Ouvrier wich extends Employe like it's possible with Hibernate.

Is my SQL code wrong to do that or is my Hibernate Tools configuration wrong or perhaps Hibernate Tools reverse ing cannot do that ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 31, 2007 7:40 am 
Regular
Regular

Joined: Sat May 20, 2006 3:49 am
Posts: 78
hi, I'm also using Hibernate Tools with Oracle 10g for a year now, but I never heared something that Hibernate Tools support generation of inheritance structures.

I think a relational database does not really have support for inheritance, you can only emulate it. There are several patterns how to map a object-oriented inheritance structure to a relational database. see the pdf Mapping Objects to Tables for a complete list of all patterns.

I think because of this inheritance is not supported with Hibernate Tools.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 31, 2007 8:04 am 
Newbie

Joined: Mon Jul 30, 2007 1:59 pm
Posts: 6
In fact I have firstly tested Hibernate Synchronizer wich was able to generate my hierarchy.

That's why I belived that Hibernate Tools was able to do it also.

So, is there a way to implement this hierarchy with a reverse strategy for example, I searched in this way but I didn't found anything about this kind of class manipulation.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 31, 2007 9:51 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hmm interesting that hibernate synchronizer detects this...what rules does it use ?

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