In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to use DetchedCriteria in Hibernate. It is very detailed and has a certain reference value. Friends who are interested must finish it!
Criteria is bound to Session, and its life cycle ends with the end of Session. When querying with Criteria, objects are dynamically created during execution each time, and various query conditions are added. As Session is recycled, Criteria is also recycled.
To be able to reuse Criteria objects, add org.hibernate.criterion.DetchedCriteria to Hibernate 3. You can first create a DetchedCriteria instance, add various query conditions, and then bind to Session when you need to query to get a Criteria object that binds Session, for example:
/ / first create DetchedCriteria object DetachedCriteria detchedCriteria = DetachedCriteria.forClass (User.class); / / add query condition detchedCriteria.add (Restrictions.ge ("age", new Integer (25)); Session session = sessionFactory.openSession (); / / bind Session and return a Criteria instance Criteria criteria = detchedCriteria.getExecutableCriteria (session); List users = criteria.list () The above is all the content of the article "how to use DetchedCriteria in Hibernate". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.