businesslogic.distribution.resource.HumanResourceDAO.java Source code

Java tutorial

Introduction

Here is the source code for businesslogic.distribution.resource.HumanResourceDAO.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: 
 * License Type: Evaluation
 */
package businesslogic.distribution.resource;

import java.util.List;

import org.hibernate.Query;
import org.orm.PersistentException;
import org.orm.PersistentSession;

import orm.OODPersistentManager;

public class HumanResourceDAO {
    public static HumanResource loadHumanResourceByORMID(int ID) throws PersistentException {
        try {
            PersistentSession session = OODPersistentManager.instance().getSession();
            return loadHumanResourceByORMID(session, ID);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static HumanResource getHumanResourceByORMID(int ID) throws PersistentException {
        try {
            PersistentSession session = OODPersistentManager.instance().getSession();
            return getHumanResourceByORMID(session, ID);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static HumanResource loadHumanResourceByORMID(int ID, org.hibernate.LockMode lockMode)
            throws PersistentException {
        try {
            PersistentSession session = OODPersistentManager.instance().getSession();
            return loadHumanResourceByORMID(session, ID, lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static HumanResource getHumanResourceByORMID(int ID, org.hibernate.LockMode lockMode)
            throws PersistentException {
        try {
            PersistentSession session = OODPersistentManager.instance().getSession();
            return getHumanResourceByORMID(session, ID, lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static HumanResource loadHumanResourceByORMID(PersistentSession session, int ID)
            throws PersistentException {
        try {
            return (HumanResource) session.load(businesslogic.distribution.resource.HumanResource.class,
                    new Integer(ID));
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static HumanResource getHumanResourceByORMID(PersistentSession session, int ID)
            throws PersistentException {
        try {
            return (HumanResource) session.get(businesslogic.distribution.resource.HumanResource.class,
                    new Integer(ID));
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static HumanResource loadHumanResourceByORMID(PersistentSession session, int ID,
            org.hibernate.LockMode lockMode) throws PersistentException {
        try {
            return (HumanResource) session.load(businesslogic.distribution.resource.HumanResource.class,
                    new Integer(ID), lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static HumanResource getHumanResourceByORMID(PersistentSession session, int ID,
            org.hibernate.LockMode lockMode) throws PersistentException {
        try {
            return (HumanResource) session.get(businesslogic.distribution.resource.HumanResource.class,
                    new Integer(ID), lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

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

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

    public static HumanResource[] listHumanResourceByQuery(String condition, String orderBy)
            throws PersistentException {
        try {
            PersistentSession session = OODPersistentManager.instance().getSession();
            return listHumanResourceByQuery(session, condition, orderBy);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

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

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

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

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

    public static HumanResource loadHumanResourceByQuery(String condition, String orderBy)
            throws PersistentException {
        try {
            PersistentSession session = OODPersistentManager.instance().getSession();
            return loadHumanResourceByQuery(session, condition, orderBy);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static HumanResource loadHumanResourceByQuery(String condition, String orderBy,
            org.hibernate.LockMode lockMode) throws PersistentException {
        try {
            PersistentSession session = OODPersistentManager.instance().getSession();
            return loadHumanResourceByQuery(session, condition, orderBy, lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static HumanResource loadHumanResourceByQuery(PersistentSession session, String condition,
            String orderBy) throws PersistentException {
        HumanResource[] humanResources = listHumanResourceByQuery(session, condition, orderBy);
        if (humanResources != null && humanResources.length > 0)
            return humanResources[0];
        else
            return null;
    }

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

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

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

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

    public static HumanResource createHumanResource() {
        return new businesslogic.distribution.resource.HumanResource();
    }

    public static boolean save(businesslogic.distribution.resource.HumanResource humanResource)
            throws PersistentException {
        try {
            OODPersistentManager.instance().saveObject(humanResource);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static boolean delete(businesslogic.distribution.resource.HumanResource humanResource)
            throws PersistentException {
        try {
            OODPersistentManager.instance().deleteObject(humanResource);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static boolean refresh(businesslogic.distribution.resource.HumanResource humanResource)
            throws PersistentException {
        try {
            OODPersistentManager.instance().getSession().refresh(humanResource);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static boolean evict(businesslogic.distribution.resource.HumanResource humanResource)
            throws PersistentException {
        try {
            OODPersistentManager.instance().getSession().evict(humanResource);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static HumanResource loadHumanResourceByCriteria(HumanResourceCriteria humanResourceCriteria) {
        HumanResource[] humanResources = listHumanResourceByCriteria(humanResourceCriteria);
        if (humanResources == null || humanResources.length == 0) {
            return null;
        }
        return humanResources[0];
    }

    public static HumanResource[] listHumanResourceByCriteria(HumanResourceCriteria humanResourceCriteria) {
        return humanResourceCriteria.listHumanResource();
    }
}