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 org.orm.*; import org.hibernate.Query; import java.util.List; public class RicaricaDAO { public static Ricarica loadRicaricaByORMID(int ID) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return loadRicaricaByORMID(session, ID); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Ricarica getRicaricaByORMID(int ID) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return getRicaricaByORMID(session, ID); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Ricarica loadRicaricaByORMID(int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return loadRicaricaByORMID(session, ID, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Ricarica getRicaricaByORMID(int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return getRicaricaByORMID(session, ID, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Ricarica loadRicaricaByORMID(PersistentSession session, int ID) throws PersistentException { try { return (Ricarica) session.load(entity.Ricarica.class, new Integer(ID)); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Ricarica getRicaricaByORMID(PersistentSession session, int ID) throws PersistentException { try { return (Ricarica) session.get(entity.Ricarica.class, new Integer(ID)); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Ricarica loadRicaricaByORMID(PersistentSession session, int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { return (Ricarica) session.load(entity.Ricarica.class, new Integer(ID), lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Ricarica getRicaricaByORMID(PersistentSession session, int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { return (Ricarica) session.get(entity.Ricarica.class, new Integer(ID), lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Ricarica[] listRicaricaByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return listRicaricaByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Ricarica[] listRicaricaByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return listRicaricaByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Ricarica[] listRicaricaByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Ricarica as Ricarica"); 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 (Ricarica[]) list.toArray(new Ricarica[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Ricarica[] listRicaricaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Ricarica as Ricarica"); 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 (Ricarica[]) list.toArray(new Ricarica[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Ricarica loadRicaricaByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return loadRicaricaByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Ricarica loadRicaricaByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return loadRicaricaByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Ricarica loadRicaricaByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { Ricarica[] ricaricas = listRicaricaByQuery(session, condition, orderBy); if (ricaricas != null && ricaricas.length > 0) return ricaricas[0]; else return null; } public static Ricarica loadRicaricaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { Ricarica[] ricaricas = listRicaricaByQuery(session, condition, orderBy, lockMode); if (ricaricas != null && ricaricas.length > 0) return ricaricas[0]; else return null; } public static java.util.Iterator iterateRicaricaByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return iterateRicaricaByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static java.util.Iterator iterateRicaricaByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession(); return iterateRicaricaByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static java.util.Iterator iterateRicaricaByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Ricarica as Ricarica"); 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 iterateRicaricaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From entity.Ricarica as Ricarica"); 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 Ricarica createRicarica() { return new entity.Ricarica(); } public static boolean save(entity.Ricarica ricarica) throws PersistentException { try { entity.ProvaSVNPersistentManager.instance().saveObject(ricarica); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean delete(entity.Ricarica ricarica) throws PersistentException { try { entity.ProvaSVNPersistentManager.instance().deleteObject(ricarica); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean refresh(entity.Ricarica ricarica) throws PersistentException { try { entity.ProvaSVNPersistentManager.instance().getSession().refresh(ricarica); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean evict(entity.Ricarica ricarica) throws PersistentException { try { entity.ProvaSVNPersistentManager.instance().getSession().evict(ricarica); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Ricarica loadRicaricaByCriteria(RicaricaCriteria ricaricaCriteria) { Ricarica[] ricaricas = listRicaricaByCriteria(ricaricaCriteria); if (ricaricas == null || ricaricas.length == 0) { return null; } return ricaricas[0]; } public static Ricarica[] listRicaricaByCriteria(RicaricaCriteria ricaricaCriteria) { return ricaricaCriteria.listRicarica(); } }