entity.GenereDAO.java Source code

Java tutorial

Introduction

Here is the source code for entity.GenereDAO.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: DuKe TeAm
 * License Type: Purchased
 */
package entity;

import java.rmi.RemoteException;
import org.orm.*;
import org.hibernate.Query;
import java.util.List;

public class GenereDAO {
    public static Genere loadGenereByORMID(String nome) throws PersistentException {
        try {
            PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession();
            return loadGenereByORMID(session, nome);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Genere getGenereByORMID(String nome) throws PersistentException {
        try {
            PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession();
            return getGenereByORMID(session, nome);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Genere loadGenereByORMID(String nome, org.hibernate.LockMode lockMode)
            throws PersistentException {
        try {
            PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession();
            return loadGenereByORMID(session, nome, lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Genere getGenereByORMID(String nome, org.hibernate.LockMode lockMode) throws PersistentException {
        try {
            PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession();
            return getGenereByORMID(session, nome, lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Genere loadGenereByORMID(PersistentSession session, String nome) throws PersistentException {
        try {
            return (Genere) session.load(entity.Genere.class, nome);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Genere getGenereByORMID(PersistentSession session, String nome) throws PersistentException {
        try {
            return (Genere) session.get(entity.Genere.class, nome);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Genere loadGenereByORMID(PersistentSession session, String nome, org.hibernate.LockMode lockMode)
            throws PersistentException {
        try {
            return (Genere) session.load(entity.Genere.class, nome, lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Genere getGenereByORMID(PersistentSession session, String nome, org.hibernate.LockMode lockMode)
            throws PersistentException {
        try {
            return (Genere) session.get(entity.Genere.class, nome, lockMode);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

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

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

    public static Genere[] listGenereByQuery(PersistentSession session, String condition, String orderBy)
            throws PersistentException {
        StringBuffer sb = new StringBuffer("From entity.Genere as Genere");
        if (condition != null)
            sb.append(" Where ").append(condition);
        if (orderBy != null)
            sb.append(" Order By ").append(orderBy);
        try {
            Query query = session.createQuery(sb.toString());
            List list = query.list();
            return (Genere[]) list.toArray(new Genere[list.size()]);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Genere[] listGenereByQuery(PersistentSession session, String condition, String orderBy,
            org.hibernate.LockMode lockMode) throws PersistentException {
        StringBuffer sb = new StringBuffer("From entity.Genere as Genere");
        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("this", lockMode);
            List list = query.list();
            return (Genere[]) list.toArray(new Genere[list.size()]);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Genere loadGenereByQuery(String condition, String orderBy) throws PersistentException {
        try {
            PersistentSession session = entity.ProvaSVNPersistentManager.instance().getSession();
            return loadGenereByQuery(session, condition, orderBy);
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

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

    public static Genere loadGenereByQuery(PersistentSession session, String condition, String orderBy)
            throws PersistentException {
        Genere[] generes = listGenereByQuery(session, condition, orderBy);
        if (generes != null && generes.length > 0)
            return generes[0];
        else
            return null;
    }

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

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

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

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

    public static Genere createGenere() throws RemoteException {
        return new entity.Genere();
    }

    public static boolean save(entity.Genere genere) throws PersistentException {
        try {
            entity.ProvaSVNPersistentManager.instance().saveObject(genere);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static boolean delete(entity.Genere genere) throws PersistentException {
        try {
            entity.ProvaSVNPersistentManager.instance().deleteObject(genere);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static boolean refresh(entity.Genere genere) throws PersistentException {
        try {
            entity.ProvaSVNPersistentManager.instance().getSession().refresh(genere);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static boolean evict(entity.Genere genere) throws PersistentException {
        try {
            entity.ProvaSVNPersistentManager.instance().getSession().evict(genere);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new PersistentException(e);
        }
    }

    public static Genere loadGenereByCriteria(GenereCriteria genereCriteria) {
        Genere[] generes = listGenereByCriteria(genereCriteria);
        if (generes == null || generes.length == 0) {
            return null;
        }
        return generes[0];
    }

    public static Genere[] listGenereByCriteria(GenereCriteria genereCriteria) {
        return genereCriteria.listGenere();
    }
}