Java tutorial
/** * "Visual Paradigm: DO NOT MODIFY THIS FILE!" * * This is an automatic generated file. It will be regenerated every time * you generate persistence class. * * Modifying its content may cause the program not work, or your work may lost. */ /** * Licensee: * License Type: Evaluation */ package businesslogic.accounting.job; import java.util.List; import org.hibernate.Query; import org.orm.PersistentException; import org.orm.PersistentSession; import orm.OODPersistentManager; public class ResourceManagementDAO { public static ResourceManagement loadResourceManagementByORMID(int ID) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return loadResourceManagementByORMID(session, ID); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ResourceManagement getResourceManagementByORMID(int ID) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return getResourceManagementByORMID(session, ID); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ResourceManagement loadResourceManagementByORMID(int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return loadResourceManagementByORMID(session, ID, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ResourceManagement getResourceManagementByORMID(int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return getResourceManagementByORMID(session, ID, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ResourceManagement loadResourceManagementByORMID(PersistentSession session, int ID) throws PersistentException { try { return (ResourceManagement) session.load(ResourceManagement.class, new Integer(ID)); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ResourceManagement getResourceManagementByORMID(PersistentSession session, int ID) throws PersistentException { try { return (ResourceManagement) session.get(ResourceManagement.class, new Integer(ID)); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ResourceManagement loadResourceManagementByORMID(PersistentSession session, int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { return (ResourceManagement) session.load(ResourceManagement.class, new Integer(ID), lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ResourceManagement getResourceManagementByORMID(PersistentSession session, int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { return (ResourceManagement) session.get(ResourceManagement.class, new Integer(ID), lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static List queryResourceManagement(String condition, String orderBy) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return queryResourceManagement(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static List queryResourceManagement(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return queryResourceManagement(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ResourceManagement[] listResourceManagementByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return listResourceManagementByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ResourceManagement[] listResourceManagementByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return listResourceManagementByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static List queryResourceManagement(PersistentSession session, String condition, String orderBy) throws PersistentException { StringBuffer sb = new StringBuffer( "From businesslogic.accounting.ResourceManagement as ResourceManagement"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try { Query query = session.createQuery(sb.toString()); return query.list(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static List queryResourceManagement(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer( "From businesslogic.accounting.ResourceManagement as ResourceManagement"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try { Query query = session.createQuery(sb.toString()); query.setLockMode("ResourceManagement", lockMode); return query.list(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ResourceManagement[] listResourceManagementByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { try { List list = queryResourceManagement(session, condition, orderBy); return (ResourceManagement[]) list.toArray(new ResourceManagement[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ResourceManagement[] listResourceManagementByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { List list = queryResourceManagement(session, condition, orderBy, lockMode); return (ResourceManagement[]) list.toArray(new ResourceManagement[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ResourceManagement loadResourceManagementByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return loadResourceManagementByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ResourceManagement loadResourceManagementByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return loadResourceManagementByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ResourceManagement loadResourceManagementByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { ResourceManagement[] resourceManagements = listResourceManagementByQuery(session, condition, orderBy); if (resourceManagements != null && resourceManagements.length > 0) return resourceManagements[0]; else return null; } public static ResourceManagement loadResourceManagementByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { ResourceManagement[] resourceManagements = listResourceManagementByQuery(session, condition, orderBy, lockMode); if (resourceManagements != null && resourceManagements.length > 0) return resourceManagements[0]; else return null; } public static java.util.Iterator iterateResourceManagementByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return iterateResourceManagementByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static java.util.Iterator iterateResourceManagementByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return iterateResourceManagementByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static java.util.Iterator iterateResourceManagementByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { StringBuffer sb = new StringBuffer( "From businesslogic.accounting.ResourceManagement as ResourceManagement"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try { Query query = session.createQuery(sb.toString()); return query.iterate(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static java.util.Iterator iterateResourceManagementByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer( "From businesslogic.accounting.ResourceManagement as ResourceManagement"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try { Query query = session.createQuery(sb.toString()); query.setLockMode("ResourceManagement", lockMode); return query.iterate(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ResourceManagement createResourceManagement() { return new ResourceManagement(); } public static boolean save(ResourceManagement resourceManagement) throws PersistentException { try { OODPersistentManager.instance().saveObject(resourceManagement); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean delete(ResourceManagement resourceManagement) throws PersistentException { try { OODPersistentManager.instance().deleteObject(resourceManagement); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean refresh(ResourceManagement resourceManagement) throws PersistentException { try { OODPersistentManager.instance().getSession().refresh(resourceManagement); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean evict(ResourceManagement resourceManagement) throws PersistentException { try { OODPersistentManager.instance().getSession().evict(resourceManagement); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ResourceManagement loadResourceManagementByCriteria( ResourceManagementCriteria resourceManagementCriteria) { ResourceManagement[] resourceManagements = listResourceManagementByCriteria(resourceManagementCriteria); if (resourceManagements == null || resourceManagements.length == 0) { return null; } return resourceManagements[0]; } public static ResourceManagement[] listResourceManagementByCriteria( ResourceManagementCriteria resourceManagementCriteria) { return resourceManagementCriteria.listResourceManagement(); } }