-->
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: org.hibernate.test.onetoone.formula
PostPosted: Thu May 29, 2008 6:47 pm 
Newbie

Joined: Thu Oct 21, 2004 10:45 am
Posts: 11
I'm trying to map something roughly the same as the org.hibernate.test.onetoone.formula example but with annotations (and unidirectional).

In practice, I'm trying to create a join between

post
id (PK)
type
posted_by (FK on person_name below)

and:

alt_names
id (PK)
person_name
type
alt_name

where the type in the person decides which alt_names row is picked.

I'm almost there with the following (in italics) but it's not happy (not a unique row returned).

@Entity
@Table...
post
@Id
id (PK)
type
@OneToOne(mappedBy="type")
@JoinColumn(name="posted_by", referencedColumnName="person_name", unique=true)

posted_by

Thanks in advance,

Digby


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 30, 2008 5:36 am 
Newbie

Joined: Thu Oct 21, 2004 10:45 am
Posts: 11
Not to worry - I've done it slightly differently with a Hashmap and then looking up the right nickname in the view.


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.