-->
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: SOS!!! Bug using Middlegen and hbm2java
PostPosted: Wed Aug 18, 2004 3:38 am 
Newbie

Joined: Tue Aug 17, 2004 9:07 am
Posts: 4
hibernate 2.1:

middlegen 2.0:

Hello,
my pbs are:

I use middlegen to generate hbm files from a database MSSQL Server 5.0.


1) when i launch the gui, no table/ relation appears and the gui is empty, but i can generate the hbm files, something to do in a setting file?

2) some tables relations in DB are like that:
table HIS_T_Act has a composite id (ActRefDos and ActId)
table HIS_T_Actcmt has a composite id (ActcmtRefDos, ActcmtRefAct) which is a foreign key from HIS_T_Act
this is a one-to-one relation, for each HIS_T_Act there is one HIS_T_Actcmt

middlegen genrates HIS_T_Actcmt.hbm.xml :

...
<class
name="org.virbac.rai.data.beans.HisTActcmt"
table="HIS_T_Actcmt"
>

<composite-id>
<!-- bi-directional one-to-one association to HisTAct -->
<key-many-to-one
name="hisTAct"
class="org.virbac.rai.data.beans.HisTAct"
>
<column name="ActcmtRefDos" />
<column name="ActcmtRefAct" />
</key-many-to-one>
</composite-id>

<property
name="actcmtTxt"
type="java.lang.String"
column="ActcmtTxt"
length="2147483647"
/>

<!-- associations -->
<!-- bi-directional one-to-one association to HisTAct -->
<one-to-one
name="hisTAct"
class="org.virbac.rai.data.beans.HisTAct"
outer-join="auto"
constrained="true"
/>

</class>
...

as you can see, there is two element whose name is "hisTAct", the <key-many-to-one> in compisite id, and the <one-to-one> link to HIS_T_Act table

so when i launch hbm2java after, i get His_T_ActCmt.java:

...


/** @author Hibernate CodeGenerator */
public class HisTActcmt implements Serializable {

/** nullable persistent field */
private String actcmtTxt;

/** nullable persistent field */
private org.virbac.rai.data.beans.HisTAct hisTAct;

/** identifier field */
private org.virbac.rai.data.beans.HisTAct hisTAct;

/** full constructor */
public HisTActcmt(String actcmtTxt, org.virbac.rai.data.beans.HisTAct hisTAct, org.virbac.rai.data.beans.HisTAct hisTAct) {
this.actcmtTxt = actcmtTxt;
this.hisTAct = hisTAct;
this.hisTAct = hisTAct;
}

/** default constructor */
public HisTActcmt() {
}

...
as you can see, there are two elements named hisTAct.
So what to do?
Please help!


Geordy


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 19, 2004 7:10 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Firstly, there is a small bug in pre R5 versions that did not always display the GUI correctly for larger number of tables. Two options, drag the JSplitter down to see the GUI or use R5.
Secondly, use R5s ability (which is standard now) to generate the plain composite keys, eg, don't use key-many-to-one.


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.