diagrama_bd.base_de_datos.AdministradorDAO.java Source code

Java tutorial

Introduction

Here is the source code for diagrama_bd.base_de_datos.AdministradorDAO.java

Source

/**
 * "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_bd.base_de_datos;

import org.orm.*;
import org.hibernate.Query;
import org.hibernate.LockMode;
import java.util.List;

public class AdministradorDAO {
    public static Administrador loadAdministradorByORMID(int nAdmin) throws PersistentException {
        try {
            PersistentSession session = diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager
                    .instance().getSession();
            return loadAdministradorByORMID(session, nAdmin);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Administrador getAdministradorByORMID(int nAdmin) throws PersistentException {
        try {
            PersistentSession session = diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager
                    .instance().getSession();
            return getAdministradorByORMID(session, nAdmin);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Administrador loadAdministradorByORMID(int nAdmin, org.hibernate.LockMode lockMode)
            throws PersistentException {
        try {
            PersistentSession session = diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager
                    .instance().getSession();
            return loadAdministradorByORMID(session, nAdmin, lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Administrador getAdministradorByORMID(int nAdmin, org.hibernate.LockMode lockMode)
            throws PersistentException {
        try {
            PersistentSession session = diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager
                    .instance().getSession();
            return getAdministradorByORMID(session, nAdmin, lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Administrador loadAdministradorByORMID(PersistentSession session, int nAdmin)
            throws PersistentException {
        try {
            return (Administrador) session.load(diagrama_bd.base_de_datos.Administrador.class, new Integer(nAdmin));
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Administrador getAdministradorByORMID(PersistentSession session, int nAdmin)
            throws PersistentException {
        try {
            return (Administrador) session.get(diagrama_bd.base_de_datos.Administrador.class, new Integer(nAdmin));
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Administrador loadAdministradorByORMID(PersistentSession session, int nAdmin,
            org.hibernate.LockMode lockMode) throws PersistentException {
        try {
            return (Administrador) session.load(diagrama_bd.base_de_datos.Administrador.class, new Integer(nAdmin),
                    lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Administrador getAdministradorByORMID(PersistentSession session, int nAdmin,
            org.hibernate.LockMode lockMode) throws PersistentException {
        try {
            return (Administrador) session.get(diagrama_bd.base_de_datos.Administrador.class, new Integer(nAdmin),
                    lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static List queryAdministrador(String condition, String orderBy) throws PersistentException {
        try {
            PersistentSession session = diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager
                    .instance().getSession();
            return queryAdministrador(session, condition, orderBy);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static List queryAdministrador(String condition, String orderBy, org.hibernate.LockMode lockMode)
            throws PersistentException {
        try {
            PersistentSession session = diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager
                    .instance().getSession();
            return queryAdministrador(session, condition, orderBy, lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Administrador[] listAdministradorByQuery(String condition, String orderBy)
            throws PersistentException {
        try {
            PersistentSession session = diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager
                    .instance().getSession();
            return listAdministradorByQuery(session, condition, orderBy);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Administrador[] listAdministradorByQuery(String condition, String orderBy,
            org.hibernate.LockMode lockMode) throws PersistentException {
        try {
            PersistentSession session = diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager
                    .instance().getSession();
            return listAdministradorByQuery(session, condition, orderBy, lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static List queryAdministrador(PersistentSession session, String condition, String orderBy)
            throws PersistentException {
        StringBuffer sb = new StringBuffer("From diagrama_bd.base_de_datos.Administrador as Administrador");
        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 queryAdministrador(PersistentSession session, String condition, String orderBy,
            org.hibernate.LockMode lockMode) throws PersistentException {
        StringBuffer sb = new StringBuffer("From diagrama_bd.base_de_datos.Administrador as Administrador");
        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("Administrador", lockMode);
            return query.list();
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Administrador[] listAdministradorByQuery(PersistentSession session, String condition,
            String orderBy) throws PersistentException {
        try {
            List list = queryAdministrador(session, condition, orderBy);
            return (Administrador[]) list.toArray(new Administrador[list.size()]);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Administrador[] listAdministradorByQuery(PersistentSession session, String condition,
            String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
        try {
            List list = queryAdministrador(session, condition, orderBy, lockMode);
            return (Administrador[]) list.toArray(new Administrador[list.size()]);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Administrador loadAdministradorByQuery(String condition, String orderBy)
            throws PersistentException {
        try {
            PersistentSession session = diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager
                    .instance().getSession();
            return loadAdministradorByQuery(session, condition, orderBy);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Administrador loadAdministradorByQuery(String condition, String orderBy,
            org.hibernate.LockMode lockMode) throws PersistentException {
        try {
            PersistentSession session = diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager
                    .instance().getSession();
            return loadAdministradorByQuery(session, condition, orderBy, lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Administrador loadAdministradorByQuery(PersistentSession session, String condition,
            String orderBy) throws PersistentException {
        Administrador[] administradors = listAdministradorByQuery(session, condition, orderBy);
        if (administradors != null && administradors.length > 0)
            return administradors[0];
        else
            return null;
    }

    public static Administrador loadAdministradorByQuery(PersistentSession session, String condition,
            String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
        Administrador[] administradors = listAdministradorByQuery(session, condition, orderBy, lockMode);
        if (administradors != null && administradors.length > 0)
            return administradors[0];
        else
            return null;
    }

    public static java.util.Iterator iterateAdministradorByQuery(String condition, String orderBy)
            throws PersistentException {
        try {
            PersistentSession session = diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager
                    .instance().getSession();
            return iterateAdministradorByQuery(session, condition, orderBy);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static java.util.Iterator iterateAdministradorByQuery(String condition, String orderBy,
            org.hibernate.LockMode lockMode) throws PersistentException {
        try {
            PersistentSession session = diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager
                    .instance().getSession();
            return iterateAdministradorByQuery(session, condition, orderBy, lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static java.util.Iterator iterateAdministradorByQuery(PersistentSession session, String condition,
            String orderBy) throws PersistentException {
        StringBuffer sb = new StringBuffer("From diagrama_bd.base_de_datos.Administrador as Administrador");
        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 iterateAdministradorByQuery(PersistentSession session, String condition,
            String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
        StringBuffer sb = new StringBuffer("From diagrama_bd.base_de_datos.Administrador as Administrador");
        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("Administrador", lockMode);
            return query.iterate();
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Administrador createAdministrador() {
        return new diagrama_bd.base_de_datos.Administrador();
    }

    public static boolean save(diagrama_bd.base_de_datos.Administrador administrador) throws PersistentException {
        try {
            diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager.instance()
                    .saveObject(administrador);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static boolean delete(diagrama_bd.base_de_datos.Administrador administrador) throws PersistentException {
        try {
            diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager.instance()
                    .deleteObject(administrador);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static boolean refresh(diagrama_bd.base_de_datos.Administrador administrador)
            throws PersistentException {
        try {
            diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager.instance().getSession()
                    .refresh(administrador);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static boolean evict(diagrama_bd.base_de_datos.Administrador administrador) throws PersistentException {
        try {
            diagrama_bd.base_de_datos.ProyectoCompletoIluminatiPersistentManager.instance().getSession()
                    .evict(administrador);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Administrador loadAdministradorByCriteria(AdministradorCriteria administradorCriteria) {
        Administrador[] administradors = listAdministradorByCriteria(administradorCriteria);
        if (administradors == null || administradors.length == 0) {
            return null;
        }
        return administradors[0];
    }

    public static Administrador[] listAdministradorByCriteria(AdministradorCriteria administradorCriteria) {
        return administradorCriteria.listAdministrador();
    }
}