com.kzone.hibernatefilter.Hibernatefilter.java Source code

Java tutorial

Introduction

Here is the source code for com.kzone.hibernatefilter.Hibernatefilter.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kzone.hibernatefilter;

import com.kzone.hibernatefilter.test.Bank;
import com.kzone.hibernatefilter.test.HibernateUtil;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

/**
 *
 * @author kasun
 */
public class Hibernatefilter {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
        Session openSession = sessionFactory.openSession();

        Searcher<Bank> bankSearcher = Searcher.createSearcher(openSession, Bank.class);
        List<Bank> search = bankSearcher.and(new ILikeFilter("bankName", "test"))
                .and(new EqualsFilter("isActive", Boolean.TRUE)).search();

        sessionFactory.close();
    }

}