• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 326
  • Last Modified:

hibernate criteria

I was reading folowing lines of junit test script code and I did not understand clearly what criteria and what restrictions do.

@Test
      public void testCriteriaForPresence() throws Exception {
            final Session session = sessionFactory.getCurrentSession();
            final Criteria criteria = session.createCriteria(Test.class).add(Restrictions.eq("flag", false));
            printList(criteria.list());
      }

Any ideas, resources,sample code,links, highly appreciated. thanks in advance.
0
gudii9
Asked:
gudii9
2 Solutions
 
cmalakarCommented:
Hibernate Criteria is basically used to create the search criteria.

Restrictions will be used to add conditions.

http://www.devarticles.com/c/a/Java/Hibernate-Criteria-Queries-in-Depth/

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now