-->
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.  [ 1 post ] 
Author Message
 Post subject: One-to-one mapping problem
PostPosted: Mon Jun 29, 2009 2:03 pm 
Regular
Regular

Joined: Tue Oct 12, 2004 9:02 am
Posts: 66
Location: Italy
I can't map this association with one-to-one:

tableA (id, cod2)
tableB(cod1, cod2, description)

As you can see tableA misses a column (I mean "cod1") to reference tableB in a one-to-one association. Anyway this is ok because I know at design-time the value of this column. So I tried this solution:

Code:
@Entity
public class EntityA {

  ...

  @OneToOne
  @JoinColumn(name="cod2", referencedColumn="cod2")
  @Where("cod1=834")
  private EntityB b;
}


But the where clause is not allowed in a one-to-one association, and also Hibernate complains about a missing join column because EntityB has a composite id.

How am I supposed to map this schema?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.