views:

191

answers:

1

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

A: 

Your @OneToOne does not seem to use a join table.

In that case, shouldn't you use a @Where annotation rather than the @WhereJoinTable that filters rows of a join table ?

Thierry
i did that, but the error persist!
Gabriel