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 entity; import java.rmi.RemoteException; import org.orm.*; import org.hibernate.Query; import java.util.List; public class RichiestaDAO { public static Richiesta loadRichiestaByORMID(int ID) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return loadRichiestaByORMID(session, ID); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Richiesta getRichiestaByORMID(int ID) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return getRichiestaByORMID(session, ID); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Richiesta loadRichiestaByORMID(int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return loadRichiestaByORMID(session, ID, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Richiesta getRichiestaByORMID(int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return getRichiestaByORMID(session, ID, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Richiesta loadRichiestaByORMID(PersistentSession session, int ID) throws PersistentException { try { return (Richiesta) session.load(entity.Richiesta.class, new Integer(ID)); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Richiesta getRichiestaByORMID(PersistentSession session, int ID) throws PersistentException { try { return (Richiesta) session.get(entity.Richiesta.class, new Integer(ID)); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Richiesta loadRichiestaByORMID(PersistentSession session, int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { return (Richiesta) session.load(entity.Richiesta.class, new Integer(ID), lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Richiesta getRichiestaByORMID(PersistentSession session, int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { return (Richiesta) session.get(entity.Richiesta.class, new Integer(ID), lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Richiesta[] listRichiestaByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return listRichiestaByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Richiesta[] listRichiestaByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return listRichiestaByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Richiesta[] listRichiestaByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Richiesta as Richiesta"); 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 (Richiesta[]) list.toArray(new Richiesta[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Richiesta[] listRichiestaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Richiesta as Richiesta"); 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 (Richiesta[]) list.toArray(new Richiesta[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Richiesta loadRichiestaByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return loadRichiestaByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Richiesta loadRichiestaByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return loadRichiestaByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Richiesta loadRichiestaByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { Richiesta[] richiestas = listRichiestaByQuery(session, condition, orderBy); if (richiestas != null && richiestas.length > 0) return richiestas[0]; else return null; } public static Richiesta loadRichiestaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { Richiesta[] richiestas = listRichiestaByQuery(session, condition, orderBy, lockMode); if (richiestas != null && richiestas.length > 0) return richiestas[0]; else return null; } public static java.util.Iterator iterateRichiestaByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return iterateRichiestaByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static java.util.Iterator iterateRichiestaByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return iterateRichiestaByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static java.util.Iterator iterateRichiestaByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Richiesta as Richiesta"); 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 iterateRichiestaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Richiesta as Richiesta"); 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 Richiesta createRichiesta() throws RemoteException { return new entity.Richiesta(); } public static boolean save(entity.Richiesta richiesta) throws PersistentException { try { entity.ProvaSVNPersistentManager.instance().saveObject(richiesta); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean delete(entity.Richiesta richiesta) throws PersistentException { try { entity.ProvaSVNPersistentManager.instance().deleteObject(richiesta); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean refresh(entity.Richiesta richiesta) throws PersistentException { try { entity.ProvaSVNPersistentManager.instance().getSession().refresh(richiesta); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean evict(entity.Richiesta richiesta) throws PersistentException { try { entity.ProvaSVNPersistentManager.instance().getSession().evict(richiesta); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Richiesta loadRichiestaByCriteria(RichiestaCriteria richiestaCriteria) { Richiesta[] richiestas = listRichiestaByCriteria(richiestaCriteria); if (richiestas == null || richiestas.length == 0) { return null; } return richiestas[0]; } public static Richiesta[] listRichiestaByCriteria(RichiestaCriteria richiestaCriteria) { return richiestaCriteria.listRichiesta(); } }