hibernate 多对多关系详解(包括中间表,一对多字表)
2012-05-25 11:13:59 来源:WEB开发网核心提示:.uniqueResult(); // Eager fetch the collection so we can use it detached /*Event anEvent = (Event) session.load(Event.class, eventId);*/// If we want to handle
.uniqueResult(); // Eager fetch the collection so we can use it detached
/*
Event anEvent = (Event) session.load(Event.class, eventId);
*/
// If we want to handle it bidirectional and detached, we also need to load this
// collection with an eager outer-join fetch, this time with Criteria and not HQL:
Event anEvent = (Event) session
.createCriteria(Event.class).setFetchMode("participants", FetchMode.JOIN)
.add( Expression.eq("id", eventId) )
更多精彩
赞助商链接