-->
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: can 'hbm2hbmxml' generate 'one-to-one' relationship?
PostPosted: Mon Nov 14, 2005 1:32 pm 
Newbie

Joined: Sun Oct 23, 2005 7:03 pm
Posts: 12
I have to tables, A and B, they are of 'one-to-one' relationship, that is, the PK of B(BId), is also a FK of AId.
But when I use 'hbm2hbmxml' to generate hbm.xml, in my A.hbm.xml,
I have:

Code:
<set name="fileHeaders" inverse="true">
            <key>
                <column name="FILE_ID" not-null="true" unique="true" />
            </key>
            <one-to-many class="com.cucbc.cgo.data.FileHeader" />
        </set>


and in my A.java generated, I have:

Code:
    public Set getB() {
        return this.b;
    }
   
    public void setB(Set b) {
        this.b = b;
    }


Obviously, Hibernate gives me a one-to-many relationship, which is not what I want. I want a 'one-to-one' relationship, like in A.java, I want:

Code:
    public B getB() {
        return this.b;
    }
   
    public void setB(B b) {
        this.b = b;
    }


Can somebody tell me how to generate this using Hibernate3 Ant Tool??

Thanks a lot!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 2:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
we dont detect one-to-one relationships when reverse engineering.

don't know if could do that safely anyway, but for now its not in there. you'll need to maually change the hbm.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.