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.distribution.resource; import java.util.List; import org.hibernate.Query; import org.orm.PersistentException; import org.orm.PersistentSession; import orm.OODPersistentManager; public class FinancialResourceDAO { public static FinancialResource loadFinancialResourceByORMID(int ID) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return loadFinancialResourceByORMID(session, ID); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static FinancialResource getFinancialResourceByORMID(int ID) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return getFinancialResourceByORMID(session, ID); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static FinancialResource loadFinancialResourceByORMID(int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return loadFinancialResourceByORMID(session, ID, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static FinancialResource getFinancialResourceByORMID(int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return getFinancialResourceByORMID(session, ID, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static FinancialResource loadFinancialResourceByORMID(PersistentSession session, int ID) throws PersistentException { try { return (FinancialResource) session.load(businesslogic.distribution.resource.FinancialResource.class, new Integer(ID)); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static FinancialResource getFinancialResourceByORMID(PersistentSession session, int ID) throws PersistentException { try { return (FinancialResource) session.get(businesslogic.distribution.resource.FinancialResource.class, new Integer(ID)); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static FinancialResource loadFinancialResourceByORMID(PersistentSession session, int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { return (FinancialResource) session.load(businesslogic.distribution.resource.FinancialResource.class, new Integer(ID), lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static FinancialResource getFinancialResourceByORMID(PersistentSession session, int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { return (FinancialResource) session.get(businesslogic.distribution.resource.FinancialResource.class, new Integer(ID), lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static List queryFinancialResource(String condition, String orderBy) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return queryFinancialResource(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static List queryFinancialResource(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return queryFinancialResource(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static FinancialResource[] listFinancialResourceByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return listFinancialResourceByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static FinancialResource[] listFinancialResourceByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return listFinancialResourceByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static List queryFinancialResource(PersistentSession session, String condition, String orderBy) throws PersistentException { StringBuffer sb = new StringBuffer( "From businesslogic.distribution.resource.FinancialResource as FinancialResource"); 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 queryFinancialResource(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer( "From businesslogic.distribution.resource.FinancialResource as FinancialResource"); 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("FinancialResource", lockMode); return query.list(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static FinancialResource[] listFinancialResourceByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { try { List list = queryFinancialResource(session, condition, orderBy); return (FinancialResource[]) list.toArray(new FinancialResource[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static FinancialResource[] listFinancialResourceByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { List list = queryFinancialResource(session, condition, orderBy, lockMode); return (FinancialResource[]) list.toArray(new FinancialResource[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static FinancialResource loadFinancialResourceByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return loadFinancialResourceByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static FinancialResource loadFinancialResourceByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return loadFinancialResourceByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static FinancialResource loadFinancialResourceByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { FinancialResource[] financialResources = listFinancialResourceByQuery(session, condition, orderBy); if (financialResources != null && financialResources.length > 0) return financialResources[0]; else return null; } public static FinancialResource loadFinancialResourceByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { FinancialResource[] financialResources = listFinancialResourceByQuery(session, condition, orderBy, lockMode); if (financialResources != null && financialResources.length > 0) return financialResources[0]; else return null; } public static java.util.Iterator iterateFinancialResourceByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return iterateFinancialResourceByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static java.util.Iterator iterateFinancialResourceByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = OODPersistentManager.instance().getSession(); return iterateFinancialResourceByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static java.util.Iterator iterateFinancialResourceByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { StringBuffer sb = new StringBuffer( "From businesslogic.distribution.resource.FinancialResource as FinancialResource"); 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 iterateFinancialResourceByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer( "From businesslogic.distribution.resource.FinancialResource as FinancialResource"); 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("FinancialResource", lockMode); return query.iterate(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static FinancialResource createFinancialResource() { return new businesslogic.distribution.resource.FinancialResource(); } public static boolean save(businesslogic.distribution.resource.FinancialResource financialResource) throws PersistentException { try { OODPersistentManager.instance().saveObject(financialResource); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean delete(businesslogic.distribution.resource.FinancialResource financialResource) throws PersistentException { try { OODPersistentManager.instance().deleteObject(financialResource); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean refresh(businesslogic.distribution.resource.FinancialResource financialResource) throws PersistentException { try { OODPersistentManager.instance().getSession().refresh(financialResource); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean evict(businesslogic.distribution.resource.FinancialResource financialResource) throws PersistentException { try { OODPersistentManager.instance().getSession().evict(financialResource); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static FinancialResource loadFinancialResourceByCriteria( FinancialResourceCriteria financialResourceCriteria) { FinancialResource[] financialResources = listFinancialResourceByCriteria(financialResourceCriteria); if (financialResources == null || financialResources.length == 0) { return null; } return financialResources[0]; } public static FinancialResource[] listFinancialResourceByCriteria( FinancialResourceCriteria financialResourceCriteria) { return financialResourceCriteria.listFinancialResource(); } }