Example usage for org.hibernate Query setString

List of usage examples for org.hibernate Query setString

Introduction

In this page you can find the example usage for org.hibernate Query setString.

Prototype

@Deprecated
@SuppressWarnings("unchecked")
default Query<R> setString(String name, String val) 

Source Link

Document

Bind a named String-valued parameter.

Usage

From source file:com.app.gpo.dao.FieldMappingDAO.java

License:Open Source License

public void delete(int id) {
    Query query = getSession()
            .createSQLQuery("delete from fieldMapping where fieldMappingID = :fieldMappingID");
    query.setString("fieldMappingID", Integer.toString(id));
    query.executeUpdate();/*from w ww .j av a 2  s  . co  m*/
}

From source file:com.app.gpo.dao.FieldMappingDAO.java

License:Open Source License

public void deleteByProductionSlotID(int id) {
    Query query = getSession()
            .createSQLQuery("delete from fieldMapping where productionSlotID = :productionSlotID");
    query.setString("productionSlotID", Integer.toString(id));
    query.executeUpdate();/*from w  ww .  j a  va  2s. c  o  m*/
}

From source file:com.app.gpo.dao.OrderItemDAO.java

License:Open Source License

public void delete(int id) {
    Query query = getSession().createSQLQuery("delete from orderItem where orderItemID = :orderItemID");
    query.setString("orderItemID", Integer.toString(id));
    query.executeUpdate();//ww  w.j  a va 2  s . c o  m
    Query query2 = getSession().createSQLQuery("delete from orderItemField where orderItemID = :orderItemID");
    query2.setString("orderItemID", Integer.toString(id));
    query2.executeUpdate();
}

From source file:com.app.gpo.dao.OrderItemDAO.java

License:Open Source License

public OrderItem findByOrderNumber(String orderNumber) {
    Query query = getSession().createSQLQuery("select from orderItem where orderNumber = :orderNumber");
    query.setString("orderNumber", orderNumber);
    OrderItem orderItem = (OrderItem) query.uniqueResult();
    Hibernate.initialize(orderItem.getorderItemFields());
    return orderItem;
}

From source file:com.app.gpo.dao.OrderItemFieldDAO.java

License:Open Source License

public void delete(int id) {
    Query query = getSession()
            .createSQLQuery("delete from orderItemField where orderItemFieldID = :orderItemFieldID");
    query.setString("orderItemFieldID", Integer.toString(id));
    query.executeUpdate();//from   w ww .  j av a2 s  . c  o  m
}

From source file:com.app.gpo.dao.OrderStatusDAO.java

License:Open Source License

public OrderStatus findByName(String statusName) {
    Query query = getSession()
            .createQuery("from OrderStatus as oS where oS.orderStatusName = :orderStatusName)");
    query.setString("orderStatusName", statusName);
    return (OrderStatus) query.uniqueResult();
}

From source file:com.app.gpo.dao.OrderStatusDAO.java

License:Open Source License

public OrderStatus findIdByName(String statusName) {
    Query query = getSession()
            .createQuery("from OrderStatus as oS where oS.orderStatusName = :orderStatusName)");
    query.setString("orderStatusName", statusName);
    OrderStatus orderStatus = (OrderStatus) query.uniqueResult();
    return orderStatus;
}

From source file:com.app.gpo.dao.OrderStatusDAO.java

License:Open Source License

public void delete(int id) {
    Query query = getSession().createSQLQuery("delete from orderStatus where orderStatusID = :orderStatusID");
    query.setString("orderStatusID", Integer.toString(id));
    query.executeUpdate();//from  www .  j  a  va  2 s.co m
}

From source file:com.app.gpo.dao.ProductionSlotDAO.java

License:Open Source License

public void delete(int id) {
    Query query = getSession()
            .createSQLQuery("delete from productionSlot where productionSlotID = :productionSlotID");
    query.setString("productionSlotID", Integer.toString(id));
    query.executeUpdate();//from   w  w  w  . j  a  va 2 s .c  o m
}

From source file:com.app.inventario.dao.seguridad.IntentosLoginDAOImpl.java

public void actualizarIntentosFallidos(String usuario) throws HibernateException {
    try {/*from w w  w  .j a v a2 s.c  om*/
        //this.iniciaOperacion();
        IntentosLogin intento = this.obtenerIntentoLogin(usuario);
        if (intento == null) {
            IntentosLogin intentoAux = new IntentosLogin(usuario, 1, new Date());
            session.save(intentoAux);
        } else {
            if (intento.getCantidadIntentos() < 3) {
                Query query = session.createQuery(
                        "UPDATE IntentosLogin SET cantidadIntentos = :cantidadIntentos, ultimoAcceso = :ultimoAcceso  WHERE usuario = :username");
                query.setInteger("cantidadIntentos", intento.getCantidadIntentos() + 1);
                query.setDate("ultimoAcceso", new Date());
                query.setString("username", usuario);
                query.executeUpdate();
            } else if (intento.getCantidadIntentos() + 1 == 3) {
                Query query = session
                        .createQuery("UPDATE Usuario SET noBloqueado = false WHERE username = :usuario");
                query.setParameter("usuario", intento.getUsuario());
                query.executeUpdate();
            }
        }
    } catch (HibernateException he) {
        this.manejaExcepcion(he);
    } finally {
    }
}