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 TerminaleDAO { public static Terminale loadTerminaleByORMID(String codice) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return loadTerminaleByORMID(session, codice); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Terminale getTerminaleByORMID(String codice) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return getTerminaleByORMID(session, codice); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Terminale loadTerminaleByORMID(String codice, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return loadTerminaleByORMID(session, codice, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Terminale getTerminaleByORMID(String codice, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return getTerminaleByORMID(session, codice, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Terminale loadTerminaleByORMID(PersistentSession session, String codice) throws PersistentException { try { return (Terminale) session.load(entity.Terminale.class, codice); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Terminale getTerminaleByORMID(PersistentSession session, String codice) throws PersistentException { try { return (Terminale) session.get(entity.Terminale.class, codice); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Terminale loadTerminaleByORMID(PersistentSession session, String codice, org.hibernate.LockMode lockMode) throws PersistentException { try { return (Terminale) session.load(entity.Terminale.class, codice, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Terminale getTerminaleByORMID(PersistentSession session, String codice, org.hibernate.LockMode lockMode) throws PersistentException { try { return (Terminale) session.get(entity.Terminale.class, codice, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Terminale[] listTerminaleByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return listTerminaleByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Terminale[] listTerminaleByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return listTerminaleByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Terminale[] listTerminaleByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Terminale as Terminale"); 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 (Terminale[]) list.toArray(new Terminale[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Terminale[] listTerminaleByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Terminale as Terminale"); 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 (Terminale[]) list.toArray(new Terminale[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Terminale loadTerminaleByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return loadTerminaleByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Terminale loadTerminaleByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return loadTerminaleByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Terminale loadTerminaleByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { Terminale[] terminales = listTerminaleByQuery(session, condition, orderBy); if (terminales != null && terminales.length > 0) return terminales[0]; else return null; } public static Terminale loadTerminaleByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { Terminale[] terminales = listTerminaleByQuery(session, condition, orderBy, lockMode); if (terminales != null && terminales.length > 0) return terminales[0]; else return null; } public static java.util.Iterator iterateTerminaleByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return iterateTerminaleByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static java.util.Iterator iterateTerminaleByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return iterateTerminaleByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static java.util.Iterator iterateTerminaleByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Terminale as Terminale"); 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 iterateTerminaleByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Terminale as Terminale"); 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 Terminale createTerminale() throws RemoteException { return new entity.Terminale(); } public static boolean save(entity.Terminale terminale) throws PersistentException { try { entity.ProvaSVNPersistentManager.instance().saveObject(terminale); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean delete(entity.Terminale terminale) throws PersistentException { try { entity.ProvaSVNPersistentManager.instance().deleteObject(terminale); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean refresh(entity.Terminale terminale) throws PersistentException { try { entity.ProvaSVNPersistentManager.instance().getSession().refresh(terminale); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean evict(entity.Terminale terminale) throws PersistentException { try { entity.ProvaSVNPersistentManager.instance().getSession().evict(terminale); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Terminale loadTerminaleByCriteria(TerminaleCriteria terminaleCriteria) { Terminale[] terminales = listTerminaleByCriteria(terminaleCriteria); if (terminales == null || terminales.length == 0) { return null; } return terminales[0]; } public static Terminale[] listTerminaleByCriteria(TerminaleCriteria terminaleCriteria) { return terminaleCriteria.listTerminale(); } }