when to use detached criteria in hibernate?

前端 未结 2 1514
甜味超标
甜味超标 2020-12-28 16:51

when to use detached criteria? and what is the advantage we get by using detached criterias instead of normal criteria?

Criteria criteria = sessionFactory.ge         


        
2条回答
  •  失恋的感觉
    2020-12-28 17:19

    As per docs

    Some applications need to create criteria queries in "detached mode", where the Hibernate session is not available. This class may be instantiated anywhere, and then a Criteria may be obtained by passing a session to getExecutableCriteria(). All methods have the same semantics and behavior as the corresponding methods of the Criteria interface.

提交回复
热议问题