br.com.PalleorrotasDePeterLund.control.dao.GlossarioDAO.java Source code

Java tutorial

Introduction

Here is the source code for br.com.PalleorrotasDePeterLund.control.dao.GlossarioDAO.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 br.com.PalleorrotasDePeterLund.control.dao;

import br.com.PalleorrotasDePeterLund.model.GenericaDAO;
import br.com.PalleorrotasDePeterLund.model.entity.Glossario;
import java.util.List;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;

/**
 *
 * @author lucas
 */
public class GlossarioDAO extends GenericaDAO<Glossario> {

    public GlossarioDAO() {
        criteria = criteria.addOrder(Order.asc("palavra"));
    }

    public List<Glossario> pegarPorPesquisa(String text) {
        entitys = criteria.add(Restrictions.ilike("palavra", text, MatchMode.ANYWHERE)).list();
        closeSession();
        return entitys;
    }

}