Mapping @OneToOne with @Where clause
Posted
by Gabriel
on Stack Overflow
See other posts from Stack Overflow
or by Gabriel
Published on 2010-03-26T12:19:39Z
Indexed on
2010/03/26
12:23 UTC
Read the original article
Hit count: 262
I am trying to map an entity as following
@OneToOne(mappedBy = "localizedLabel")
@JoinColumn(insertable = false, updatable = false)
@WhereJoinTable(clause = "locale='en_US'")
public Localization getEn_US() {
return en_US;
}
I can assure that the data will return only one or null if the not found, but hibernate seems to ignore my @Where clause:
ERROR com.eventtouch.bc.business.core.log.LoggingInterceptor - org.hibernate.HibernateException: More than one row with the given identifier was found: 4211, for class: com.eventtouch.bc.business.domain.LocalizedLabel
Any ideas on ho to map a @OneToOne relationship with @Where clause?
Thanks
© Stack Overflow or respective owner