WEB开发网
开发学院软件开发Java hibernate 多对多关系详解(包括中间表,一对多字表... 阅读

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) )

上一页  18 19 20 21 22 23 24 25 26  下一页

Tags:hibernate 关系 详解

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接