businesslogic.distribution.resource.ModuleChangeDAO.java Source code

Java tutorial

Introduction

Here is the source code for businesslogic.distribution.resource.ModuleChangeDAO.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 ModuleChangeDAO {
    public static ModuleChange loadModuleChangeByORMID(int ID) throws PersistentException {
        try {
            PersistentSession session = OODPersistentManager.instance().getSession();
            return loadModuleChangeByORMID(session, ID);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    public static ModuleChange loadModuleChangeByQuery(PersistentSession session, String condition, String orderBy)
            throws PersistentException {
        ModuleChange[] moduleChanges = listModuleChangeByQuery(session, condition, orderBy);
        if (moduleChanges != null && moduleChanges.length > 0)
            return moduleChanges[0];
        else
            return null;
    }

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

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

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

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

    public static ModuleChange createModuleChange() {
        return new businesslogic.distribution.resource.ModuleChange();
    }

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

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

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

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

    public static ModuleChange loadModuleChangeByCriteria(ModuleChangeCriteria moduleChangeCriteria) {
        ModuleChange[] moduleChanges = listModuleChangeByCriteria(moduleChangeCriteria);
        if (moduleChanges == null || moduleChanges.length == 0) {
            return null;
        }
        return moduleChanges[0];
    }

    public static ModuleChange[] listModuleChangeByCriteria(ModuleChangeCriteria moduleChangeCriteria) {
        return moduleChangeCriteria.listModuleChange();
    }
}