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: DuKe TeAm * License Type: Purchased */ package foundation; import org.orm.*; import org.hibernate.Query; import java.util.List; public class ETariffaDAO { public static ETariffa loadETariffaByORMID(int ID) throws PersistentException { try { PersistentSession session = foundation.TimeLoggingPersistentManager.instance().getSession(); return loadETariffaByORMID(session, ID); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ETariffa getETariffaByORMID(int ID) throws PersistentException { try { PersistentSession session = foundation.TimeLoggingPersistentManager.instance().getSession(); return getETariffaByORMID(session, ID); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ETariffa loadETariffaByORMID(int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = foundation.TimeLoggingPersistentManager.instance().getSession(); return loadETariffaByORMID(session, ID, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ETariffa getETariffaByORMID(int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = foundation.TimeLoggingPersistentManager.instance().getSession(); return getETariffaByORMID(session, ID, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ETariffa loadETariffaByORMID(PersistentSession session, int ID) throws PersistentException { try { return (ETariffa) session.load(foundation.ETariffa.class, new Integer(ID)); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ETariffa getETariffaByORMID(PersistentSession session, int ID) throws PersistentException { try { return (ETariffa) session.get(foundation.ETariffa.class, new Integer(ID)); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ETariffa loadETariffaByORMID(PersistentSession session, int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { return (ETariffa) session.load(foundation.ETariffa.class, new Integer(ID), lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ETariffa getETariffaByORMID(PersistentSession session, int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { return (ETariffa) session.get(foundation.ETariffa.class, new Integer(ID), lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ETariffa[] listETariffaByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = foundation.TimeLoggingPersistentManager.instance().getSession(); return listETariffaByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ETariffa[] listETariffaByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = foundation.TimeLoggingPersistentManager.instance().getSession(); return listETariffaByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ETariffa[] listETariffaByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { StringBuffer sb = new StringBuffer("From foundation.ETariffa as ETariffa"); if (condition != null) sb.append(" Where ").append(condition); if (orderBy != null) sb.append(" Order By ").append(orderBy); try { Query query = session.createQuery(sb.toString()); List list = query.list(); return (ETariffa[]) list.toArray(new ETariffa[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ETariffa[] listETariffaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From foundation.ETariffa as ETariffa"); 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("this", lockMode); List list = query.list(); return (ETariffa[]) list.toArray(new ETariffa[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ETariffa loadETariffaByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = foundation.TimeLoggingPersistentManager.instance().getSession(); return loadETariffaByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ETariffa loadETariffaByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = foundation.TimeLoggingPersistentManager.instance().getSession(); return loadETariffaByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ETariffa loadETariffaByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { ETariffa[] eTariffas = listETariffaByQuery(session, condition, orderBy); if (eTariffas != null && eTariffas.length > 0) return eTariffas[0]; else return null; } public static ETariffa loadETariffaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { ETariffa[] eTariffas = listETariffaByQuery(session, condition, orderBy, lockMode); if (eTariffas != null && eTariffas.length > 0) return eTariffas[0]; else return null; } public static java.util.Iterator iterateETariffaByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = foundation.TimeLoggingPersistentManager.instance().getSession(); return iterateETariffaByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static java.util.Iterator iterateETariffaByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = foundation.TimeLoggingPersistentManager.instance().getSession(); return iterateETariffaByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static java.util.Iterator iterateETariffaByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { StringBuffer sb = new StringBuffer("From foundation.ETariffa as ETariffa"); 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 iterateETariffaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From foundation.ETariffa as ETariffa"); 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("this", lockMode); return query.iterate(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ETariffa createETariffa() { return new foundation.ETariffa(); } public static boolean save(foundation.ETariffa eTariffa) throws PersistentException { try { foundation.TimeLoggingPersistentManager.instance().saveObject(eTariffa); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean delete(foundation.ETariffa eTariffa) throws PersistentException { try { foundation.TimeLoggingPersistentManager.instance().deleteObject(eTariffa); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean deleteAndDissociate(foundation.ETariffa eTariffa) throws PersistentException { try { if (eTariffa.geteTask() != null) { eTariffa.geteTask().eTariffa.remove(eTariffa); } return delete(eTariffa); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean deleteAndDissociate(foundation.ETariffa eTariffa, org.orm.PersistentSession session) throws PersistentException { try { if (eTariffa.geteTask() != null) { eTariffa.geteTask().eTariffa.remove(eTariffa); } try { session.delete(eTariffa); return true; } catch (Exception e) { return false; } } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean refresh(foundation.ETariffa eTariffa) throws PersistentException { try { foundation.TimeLoggingPersistentManager.instance().getSession().refresh(eTariffa); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean evict(foundation.ETariffa eTariffa) throws PersistentException { try { foundation.TimeLoggingPersistentManager.instance().getSession().evict(eTariffa); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static ETariffa loadETariffaByCriteria(ETariffaCriteria eTariffaCriteria) { ETariffa[] eTariffas = listETariffaByCriteria(eTariffaCriteria); if (eTariffas == null || eTariffas.length == 0) { return null; } return eTariffas[0]; } public static ETariffa[] listETariffaByCriteria(ETariffaCriteria eTariffaCriteria) { return eTariffaCriteria.listETariffa(); } }