businesslogic.accounting.job.UserJobDAO.java Source code

Java tutorial

Introduction

Here is the source code for businesslogic.accounting.job.UserJobDAO.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.accounting.job;

import java.util.List;

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

import orm.OODPersistentManager;

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

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

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

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

    public static UserJob loadUserJobByORMID(PersistentSession session, int ID) throws PersistentException {
        try {
            return (UserJob) session.load(businesslogic.accounting.job.UserJob.class, new Integer(ID));
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static UserJob getUserJobByORMID(PersistentSession session, int ID) throws PersistentException {
        try {
            return (UserJob) session.get(businesslogic.accounting.job.UserJob.class, new Integer(ID));
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static UserJob loadUserJobByORMID(PersistentSession session, int ID, org.hibernate.LockMode lockMode)
            throws PersistentException {
        try {
            return (UserJob) session.load(businesslogic.accounting.job.UserJob.class, new Integer(ID), lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static UserJob getUserJobByORMID(PersistentSession session, int ID, org.hibernate.LockMode lockMode)
            throws PersistentException {
        try {
            return (UserJob) session.get(businesslogic.accounting.job.UserJob.class, new Integer(ID), lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

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

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

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

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

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

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

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

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

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

    public static UserJob loadUserJobByQuery(PersistentSession session, String condition, String orderBy)
            throws PersistentException {
        UserJob[] userJobs = listUserJobByQuery(session, condition, orderBy);
        if (userJobs != null && userJobs.length > 0)
            return userJobs[0];
        else
            return null;
    }

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

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

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

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

    public static UserJob createUserJob() {
        return new businesslogic.accounting.job.UserJob();
    }

    public static boolean save(businesslogic.accounting.job.UserJob userJob) throws PersistentException {
        try {
            OODPersistentManager.instance().saveObject(userJob);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static boolean delete(businesslogic.accounting.job.UserJob userJob) throws PersistentException {
        try {
            OODPersistentManager.instance().deleteObject(userJob);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static boolean refresh(businesslogic.accounting.job.UserJob userJob) throws PersistentException {
        try {
            OODPersistentManager.instance().getSession().refresh(userJob);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static boolean evict(businesslogic.accounting.job.UserJob userJob) throws PersistentException {
        try {
            OODPersistentManager.instance().getSession().evict(userJob);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static UserJob loadUserJobByCriteria(UserJobCriteria userJobCriteria) {
        UserJob[] userJobs = listUserJobByCriteria(userJobCriteria);
        if (userJobs == null || userJobs.length == 0) {
            return null;
        }
        return userJobs[0];
    }

    public static UserJob[] listUserJobByCriteria(UserJobCriteria userJobCriteria) {
        return userJobCriteria.listUserJob();
    }
}