List of usage examples for org.hibernate Session getNamedQuery
org.hibernate.Query getNamedQuery(String queryName);
From source file:com.abiquo.abiserver.persistence.dao.infrastructure.hibernate.PhysicalMachineDAOHibernate.java
License:Open Source License
@Override public String getHypervisorIP(final int machineId) { Session session = HibernateDAOFactory.getSessionFactory().getCurrentSession(); Query pmQuery = session.getNamedQuery(PHYSICALMACHINE_GET_HYPERVISOR_IP); pmQuery.setInteger("idphysicalmachine", machineId); String hyperIp = (String) pmQuery.uniqueResult(); return hyperIp; }
From source file:com.abiquo.abiserver.persistence.dao.infrastructure.hibernate.PhysicalMachineDAOHibernate.java
License:Open Source License
@Override public PhysicalmachineHB findByIp(final String hypervisorIp, final Integer idDataCenter) { Session session = HibernateDAOFactory.getSessionFactory().getCurrentSession(); Query pmQuery = session.getNamedQuery(PHYSICALMACHINE_GET_FROM_IP); pmQuery.setString("ipPhysicalMachine", hypervisorIp); pmQuery.setInteger("idDataCenter", idDataCenter); PhysicalmachineHB pm = (PhysicalmachineHB) pmQuery.uniqueResult(); return pm;/*from w w w . j a v a 2 s. c om*/ }
From source file:com.abiquo.abiserver.persistence.dao.infrastructure.hibernate.PhysicalMachineDAOHibernate.java
License:Open Source License
@Override public List<String> findAllIp() { Session session = HibernateDAOFactory.getSessionFactory().getCurrentSession(); Query pmQuery = session.getNamedQuery(PHYSICALMACHINE_GET_ALL_HYPERVISOR_IP); return pmQuery.list(); }
From source file:com.abiquo.abiserver.persistence.dao.infrastructure.hibernate.PhysicalMachineDAOHibernate.java
License:Open Source License
@Override public List<VirtualmachineHB> getNotDeployedVirtualMachines(final Integer hostId) { Session session = HibernateDAOFactory.getSessionFactory().getCurrentSession(); Query pmQuery = session.getNamedQuery(PHYSICALMACHINE_GET_NOT_MANAGED_VIRTUAL_MACHINES); pmQuery.setInteger("idphysicalmachine", hostId); return pmQuery.list(); }
From source file:com.abiquo.abiserver.persistence.dao.infrastructure.hibernate.PhysicalMachineDAOHibernate.java
License:Open Source License
@Override public List<PhysicalmachineHB> getPhysicalMachineListByDatastore(final Integer datastoreId) { Session session = HibernateDAOFactory.getSessionFactory().getCurrentSession(); Query pmQuery = session.getNamedQuery(PHYSICALMACHINE_GET_LIST_BY_DATASTORE); pmQuery.setInteger("idDatastore", datastoreId); return pmQuery.list(); }
From source file:com.abiquo.abiserver.persistence.dao.infrastructure.hibernate.PhysicalMachineDAOHibernate.java
License:Open Source License
@Override public List<PhysicalmachineHB> getPhysicalMachineByRack(final Integer rackId, final String filters) { Session session = HibernateDAOFactory.getSessionFactory().getCurrentSession(); String namedQuery = filters == null || filters.isEmpty() ? PHYSICALMACHINE_GET_LIST_BY_RACK : "PHYSICALMACHINE.GET_LIST_BY_RACK_AND_ENTERPRISE"; Query pmQuery = session.getNamedQuery(namedQuery); pmQuery.setInteger("idRack", rackId); if (filters != null && !filters.isEmpty()) { pmQuery.setString("filterLike", "%" + filters + "%"); }//from w ww . jav a2 s . c om return pmQuery.list(); }
From source file:com.abiquo.abiserver.persistence.dao.infrastructure.hibernate.RackDAOHibernate.java
License:Open Source License
@Override public List<Integer> getRackIdByMinVlanCount(Integer vlan_vdc, Integer idVApp) { Session session = HibernateDAOFactory.getSessionFactory().getCurrentSession(); Query query = session.getNamedQuery(FIND_BY_MIN_VLANS); query.setInteger("vlan_vdc", vlan_vdc); query.setInteger("idVApp", idVApp); return (List<Integer>) query.list(); }
From source file:com.abiquo.abiserver.persistence.dao.infrastructure.hibernate.RackDAOHibernate.java
License:Open Source License
@SuppressWarnings("unchecked") @Override//from w w w .j a va2 s . c om public List<PhysicalmachineHB> getPhysicalMachines(Integer rackId, String filters) { try { final Session session = HibernateDAOFactory.getSessionFactory().getCurrentSession(); final Query query = session.getNamedQuery(GET_PHYSICAL_MACHINES_BY_RACK); query.setInteger("idRack", rackId); // query.setString("filterLike", (filters == null || filters.isEmpty()) ? "%" : "%" + // filters + "%"); return (ArrayList<PhysicalmachineHB>) query.list(); } catch (HibernateException he) { throw new PersistenceException(he.getMessage()); } }
From source file:com.abiquo.abiserver.persistence.dao.infrastructure.hibernate.RemoteServiceDAOHibernate.java
License:Open Source License
@Override public List<RemoteServiceHB> getAllRemoteServices(final Integer idDataCenter) { Session session = HibernateDAOFactory.getSessionFactory().getCurrentSession(); Query pmQuery = session.getNamedQuery(REMOTE_SERVICE_GET_REMOTE_SERVICES_BY_DATACENTER); pmQuery.setInteger("idDataCenter", idDataCenter); return pmQuery.list(); }
From source file:com.abiquo.abiserver.persistence.dao.infrastructure.hibernate.RemoteServiceDAOHibernate.java
License:Open Source License
@Override public List<RemoteServiceHB> getRemoteServicesByType(final Integer idDataCenter, final RemoteServiceType remoteServiceType) { Session session = HibernateDAOFactory.getSessionFactory().getCurrentSession(); Query pmQuery = session.getNamedQuery(REMOTE_SERVICE_GET_REMOTE_SERVICES_BY_TYPE); pmQuery.setInteger("idDataCenter", idDataCenter); pmQuery.setParameter("remoteServiceType", remoteServiceType); return pmQuery.list(); }