-->
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: Changing a mapping from component to one-to-one
PostPosted: Thu Apr 29, 2004 4:07 pm 
Beginner
Beginner

Joined: Tue Dec 30, 2003 1:51 pm
Posts: 49
Location: Michigan, USA
Hello,
I am changing a mapping from a component to a one-to-one type. Here is my question, because I had a hard time with this before.

I have two classes

Code:
class Person{

private long id;
private Address address;
...

/**
* Returns the address.
* @hibernate.one-to-one name="getAddress" 
    class="foo.ejb.user.AddressBean"
*   cascade="all"
*   constrained="true"
* @return AddressBean
*/
public AddressBean getAddress() {
   return address;
}
}

class Address{

long id
...

/**
* Returns the id.
* @hibernate.id generator-class="foregin" type="long" column="id"
* unsaved-value="-1"
* @return long
*/
public Long getId() {
   return id;
}
}


Is this correct? My understanding is that when I save person that the id would also be assigned to address. Any help would be great!

---jason


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 29, 2004 4:31 pm 
Beginner
Beginner

Joined: Tue Dec 30, 2003 1:51 pm
Posts: 49
Location: Michigan, USA
nevermind got it.

HIBERNATE ROCKS!!!


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.