我正在尝试将实体映射如下
@OneToOne(mappedBy = "localizedLabel")
@JoinColumn(insertable = false, updatable = false)
@WhereJoinTable(clause = "locale='en_US'")
public Localization getEn_US() {
return en_US;
}
我可以保证如果未找到数据将只返回一个或 null,但休眠似乎忽略了我的 @Where 子句:
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
关于如何将@OneToOne 关系与@Where 子句映射的任何想法?
谢谢