hibernate criteria

Posted on 2011-05-05
Last Modified: 2012-06-21
I was reading folowing lines of junit test script code and I did not understand clearly what criteria and what restrictions do.

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

Any ideas, resources,sample code,links, highly appreciated. thanks in advance.
Question by:gudii9
    LVL 23

    Accepted Solution

    Hibernate Criteria is basically used to create the search criteria.

    Restrictions will be used to add conditions.

    LVL 20

    Assisted Solution

    by:Amitkumar Panchal

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
    INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
    Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
    Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now