0
在我來說,我有一個SQL查詢,看起來像:Hibernate的標準來選擇使用嵌入對象(元組)
select * from event_instance where (object_id, object_type) in
(<LIST OF TUPLES RETRIEVED FROM SUBQUERY>);
我想在Hibernate的實體地圖這和我有這個查詢的一個問題。我的映射看起來像這樣:
@Entity
@Table(name="event_instance")
public class AuditEvent {
<OTHER_FIELDS>
@Column(name = "object_type", nullable = false)
private String objectType;
@Column(name ="object_id" , nullable = false)
private Integer objectId;
}
和第二實體:
@Entity
@Table(schema = "els" ,name = "acg_objects")
public class AcgObject implements Serializable{
@Id
@Column(name = "acg_id")
private String acgId;
@Id
@Column(name="object_type")
private String objectType;
@Id
@Column(name="object_id")
private Integer objectId;
<OTHER FIELDS>
}
我已經爲越來越AcgObjects運行查詢和我的DAO我越來越僅列出我想要做的事情就是查詢touple使用類似的標準:
crit.add(Restrictions.in("objectType,objectId",<List of tuples>);
這可能嗎?我試圖使用@Embedded對象,但不知道如何爲它構建查詢。請幫忙