1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
package videobd;
import java.util.List;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.criterion.Example;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A data access object (DAO) providing persistence and search support for
* Realisateurs entities. Transaction control of the save(), update() and
* delete() operations can directly support Spring container-managed
* transactions or they can be augmented to handle user-managed Spring
* transactions. Each of these methods provides additional information for how
* to configure it for the desired type of transaction control.
*
* @see videobd.Realisateurs
* @author MyEclipse Persistence Tools
*/
public class RealisateursDAO extends BaseHibernateDAO {
private static final Logger log = LoggerFactory
.getLogger(RealisateursDAO.class);
// property constants
public static final String NOM_REALISATEUR = "nomRealisateur";
public static final String PRENOM_REALISATEUR = "prenomRealisateur";
public void save(Realisateurs transientInstance) {
log.debug("saving Realisateurs instance");
try {
getSession().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Realisateurs persistentInstance) {
log.debug("deleting Realisateurs instance");
try {
getSession().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Realisateurs findById(java.lang.Integer id) {
log.debug("getting Realisateurs instance with id: " + id);
try {
Realisateurs instance = (Realisateurs) getSession().get(
"videobd.Realisateurs", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Realisateurs instance) {
log.debug("finding Realisateurs instance by example");
try {
List results = getSession().createCriteria("videobd.Realisateurs")
.add(Example.create(instance)).list();
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding Realisateurs instance with property: "
+ propertyName + ", value: " + value);
try {
String queryString = "from Realisateurs as model where model."
+ propertyName + "= ?";
Query queryObject = getSession().createQuery(queryString);
queryObject.setParameter(0, value);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public List findByNomRealisateur(Object nomRealisateur) {
return findByProperty(NOM_REALISATEUR, nomRealisateur);
}
public List findByPrenomRealisateur(Object prenomRealisateur) {
return findByProperty(PRENOM_REALISATEUR, prenomRealisateur);
}
public List findAll() {
log.debug("finding all Realisateurs instances");
try {
String queryString = "from Realisateurs";
Query queryObject = getSession().createQuery(queryString);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public Realisateurs merge(Realisateurs detachedInstance) {
log.debug("merging Realisateurs instance");
try {
Realisateurs result = (Realisateurs) getSession().merge(
detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Realisateurs instance) {
log.debug("attaching dirty Realisateurs instance");
try {
getSession().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Realisateurs instance) {
log.debug("attaching clean Realisateurs instance");
try {
getSession().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
} |
Partager