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: University of Almeria * License Type: Academic */ package diagrama_de_base_de_datos; import org.orm.*; import org.hibernate.Query; import org.hibernate.LockMode; import java.util.List; public class DescargaDAO { public static Descarga loadDescargaByORMID(int ID) throws PersistentException { try { PersistentSession session = diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.instance() .getSession(); return loadDescargaByORMID(session, ID); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Descarga getDescargaByORMID(int ID) throws PersistentException { try { PersistentSession session = diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.instance() .getSession(); return getDescargaByORMID(session, ID); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Descarga loadDescargaByORMID(int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.instance() .getSession(); return loadDescargaByORMID(session, ID, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Descarga getDescargaByORMID(int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.instance() .getSession(); return getDescargaByORMID(session, ID, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Descarga loadDescargaByORMID(PersistentSession session, int ID) throws PersistentException { try { return (Descarga) session.load(diagrama_de_base_de_datos.Descarga.class, new Integer(ID)); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Descarga getDescargaByORMID(PersistentSession session, int ID) throws PersistentException { try { return (Descarga) session.get(diagrama_de_base_de_datos.Descarga.class, new Integer(ID)); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Descarga loadDescargaByORMID(PersistentSession session, int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { return (Descarga) session.load(diagrama_de_base_de_datos.Descarga.class, new Integer(ID), lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Descarga getDescargaByORMID(PersistentSession session, int ID, org.hibernate.LockMode lockMode) throws PersistentException { try { return (Descarga) session.get(diagrama_de_base_de_datos.Descarga.class, new Integer(ID), lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static List queryDescarga(String condition, String orderBy) throws PersistentException { try { PersistentSession session = diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.instance() .getSession(); return queryDescarga(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static List queryDescarga(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.instance() .getSession(); return queryDescarga(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Descarga[] listDescargaByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.instance() .getSession(); return listDescargaByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Descarga[] listDescargaByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.instance() .getSession(); return listDescargaByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static List queryDescarga(PersistentSession session, String condition, String orderBy) throws PersistentException { StringBuffer sb = new StringBuffer("From diagrama_de_base_de_datos.Descarga as Descarga"); 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 queryDescarga(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From diagrama_de_base_de_datos.Descarga as Descarga"); 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("Descarga", lockMode); return query.list(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Descarga[] listDescargaByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { try { List list = queryDescarga(session, condition, orderBy); return (Descarga[]) list.toArray(new Descarga[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Descarga[] listDescargaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { List list = queryDescarga(session, condition, orderBy, lockMode); return (Descarga[]) list.toArray(new Descarga[list.size()]); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Descarga loadDescargaByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.instance() .getSession(); return loadDescargaByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Descarga loadDescargaByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.instance() .getSession(); return loadDescargaByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Descarga loadDescargaByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { Descarga[] descargas = listDescargaByQuery(session, condition, orderBy); if (descargas != null && descargas.length > 0) return descargas[0]; else return null; } public static Descarga loadDescargaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { Descarga[] descargas = listDescargaByQuery(session, condition, orderBy, lockMode); if (descargas != null && descargas.length > 0) return descargas[0]; else return null; } public static java.util.Iterator iterateDescargaByQuery(String condition, String orderBy) throws PersistentException { try { PersistentSession session = diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.instance() .getSession(); return iterateDescargaByQuery(session, condition, orderBy); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static java.util.Iterator iterateDescargaByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { try { PersistentSession session = diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.instance() .getSession(); return iterateDescargaByQuery(session, condition, orderBy, lockMode); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static java.util.Iterator iterateDescargaByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException { StringBuffer sb = new StringBuffer("From diagrama_de_base_de_datos.Descarga as Descarga"); 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 iterateDescargaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException { StringBuffer sb = new StringBuffer("From diagrama_de_base_de_datos.Descarga as Descarga"); 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("Descarga", lockMode); return query.iterate(); } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Descarga createDescarga() { return new diagrama_de_base_de_datos.Descarga(); } public static boolean save(diagrama_de_base_de_datos.Descarga descarga) throws PersistentException { try { diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.instance().saveObject(descarga); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean delete(diagrama_de_base_de_datos.Descarga descarga) throws PersistentException { try { diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.instance().deleteObject(descarga); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean refresh(diagrama_de_base_de_datos.Descarga descarga) throws PersistentException { try { diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.instance().getSession().refresh(descarga); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static boolean evict(diagrama_de_base_de_datos.Descarga descarga) throws PersistentException { try { diagrama_de_base_de_datos.ProyectoMDS2PersistentManager.instance().getSession().evict(descarga); return true; } catch (Exception e) { e.printStackTrace(); throw new PersistentException(e); } } public static Descarga loadDescargaByCriteria(DescargaCriteria descargaCriteria) { Descarga[] descargas = listDescargaByCriteria(descargaCriteria); if (descargas == null || descargas.length == 0) { return null; } return descargas[0]; } public static Descarga[] listDescargaByCriteria(DescargaCriteria descargaCriteria) { return descargaCriteria.listDescarga(); } }