-->
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.  [ 7 posts ] 
Author Message
 Post subject: Add relationship through middlegen? How?!
PostPosted: Wed Jul 21, 2004 6:54 pm 
Beginner
Beginner

Joined: Wed Jul 21, 2004 6:50 pm
Posts: 27
Hi,

Finally got middlegen hibernate plug-in working, and loaded up an existing database.

The current application code was handling the foreign key relationships, but I would like to change this when I rearchitect everything and employ hibernate.

Obviously, no relationships are showing in the GUI, but I can't find a way to add them! Can anyone point me in the right direction?

Many thanks,

David

PS Using SAPDB 7.4


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 21, 2004 7:12 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Outside of adding the constraints to the database, you can use the table tag with the cross reference attribute to setup the relationships if the constrints don't exist.

http://boss.bekk.no/boss/middlegen/ant/table.html


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 1:11 pm 
Beginner
Beginner

Joined: Wed Jul 21, 2004 6:50 pm
Posts: 27
So there's no way to do it through the GUI? I imagined I could just specifiy it there, or even better, do it by dragging the mouse.

If not, can this be added as a feature request?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 2:59 pm 
Newbie

Joined: Thu Jul 22, 2004 2:48 pm
Posts: 5
Could someone give an example how the pktable should be defined? I looked into document but found it too vague to start with.


I ran into a problem that the tables i am working on, contain unique index constraint, not primary key constraint. And middlegen only tries to get primary keys only.

Thanks

Albert L.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 5:20 pm 
Newbie

Joined: Thu Jul 22, 2004 2:48 pm
Posts: 5
Saig wrote:
Could someone give an example how the pktable should be defined? I looked into document but found it too vague to start with.


I ran into a problem that the tables i am working on, contain unique index constraint, not primary key constraint. And middlegen only tries to get primary keys only.

Thanks

Albert L.



Sorry, I posted this message in wrong thread. Should've been in new thread.

But I found out answer to my question. It uses pkcolumnsoverride, for example, <table name="tbl_nokey" pkcolumnsoverride="col1, col2, col3"/> to create composite-id on col1,col2,col3. Need to download src from CVS not from sourceforge download pages since it was too old (Jan 8 2004). The patch was put in sometime in March or May 2004.

Sorry again!


Top
 Profile  
 
 Post subject: Re: Add relationship through middlegen? How?!
PostPosted: Thu Jul 22, 2004 5:58 pm 
Newbie

Joined: Thu Jul 22, 2004 2:48 pm
Posts: 5
hay7777 wrote:
Hi,

Finally got middlegen hibernate plug-in working, and loaded up an existing database.

The current application code was handling the foreign key relationships, but I would like to change this when I rearchitect everything and employ hibernate.

Obviously, no relationships are showing in the GUI, but I can't find a way to add them! Can anyone point me in the right direction?

Many thanks,

David

PS Using SAPDB 7.4



If you want to add a new linkage, that is quite easy (i guess). To define a new linkage from alu_nokey to alu_nokey_xref, something like this within middlegen task should work.

<table name="alu_nokey" pkcolumnsoverride="col1,col2">
<crossref fktable="alu_nokey_xref" fkcolumn="pk1" pkcolumn="col1"/>
<crossref fktable="alu_nokey_xref" fkcolumn="..." pkcolumn="..."/>
</table>

where:
table alu_nokey columns: (no any primary keys defined for this table)
col1
col2
col3
col4

table alu_nokey_xref columns: (primary key constraints are pk1, pk2)
pk1
pk2
col1
col2

see linkage created by middlegen as:
http://home.comcast.net/~albert.lu/publ ... ossref.JPG

(pkcolumnsoverride needs new src from cvs not from sourceforge download page)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 6:29 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
You you can create a Feature request in Middlegens JIRA.


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