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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
|
package com.yourcompany.hibernate.utilisateur;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.criterion.Example;
/**
* Data access object (DAO) for domain model class Utilisateur.
* @see com.yourcompany.hibernate.Utilisateur.Utilisateur
* @author MyEclipse Persistence Tools
*/
public class UtilisateurDAO extends Utilisateur {
/**
*
*/
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(UtilisateurDAO.class);
//property constants
public static final String PSWORD = "psword";
public static final String NOM = "nom";
public static final String PRENOM = "prenom";
public static final String EMAIL = "email";
public static final String SEXE = "sexe";
public static final String ADRESSE = "adresse";
public static final String PAYS = "pays";
public static final String QUSTION_SECRIE = "qustionSecrie";
public static final String REPONSE_QUSTION_SECRIE = "reponseQustionSecrie";
public static final String VILLE = "ville";
public void save(Utilisateur transientInstance) {
log.debug("saving Utilisateur instance");
try {
getSession().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Utilisateur persistentInstance) {
log.debug("deleting Utilisateur instance");
try {
getSession().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
////////////////////////la linge 64
public Utilisateur findById( java.lang.String id) {
log.debug("getting Utilisateur instance with id: " + id);
try {
Utilisateur instance = (Utilisateur) getSession()
.get("com.yourcompany.hibernate.utilisateur.Utilisateur", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Utilisateur instance) {
log.debug("finding Utilisateur instance by example");
try {
List results = getSession()
.createCriteria("com.yourcompany.hibernate.utilisateur.Utilisateur")
.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 Utilisateur instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Utilisateur 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 findByPsword(Object psword) {
return findByProperty(PSWORD, psword);
}
public List findByNom(Object nom) {
return findByProperty(NOM, nom);
}
public List findByPrenom(Object prenom) {
return findByProperty(PRENOM, prenom);
}
public List findByEmail(Object email) {
return findByProperty(EMAIL, email);
}
public List findBySexe(Object sexe) {
return findByProperty(SEXE, sexe);
}
public List findByAdresse(Object adresse) {
return findByProperty(ADRESSE, adresse);
}
public List findByPays(Object pays) {
return findByProperty(PAYS, pays);
}
public List findByQustionSecrie(Object qustionSecrie) {
return findByProperty(QUSTION_SECRIE, qustionSecrie);
}
public List findByReponseQustionSecrie(Object reponseQustionSecrie) {
return findByProperty(REPONSE_QUSTION_SECRIE, reponseQustionSecrie);
}
public List findByVille(Object ville) {
return findByProperty(VILLE, ville);
}
public List findAll() {
log.debug("finding all Utilisateur instances");
try {
String queryString = "from Utilisateur";
Query queryObject = getSession().createQuery(queryString);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public Utilisateur merge(Utilisateur detachedInstance) {
log.debug("merging Utilisateur instance");
try {
Utilisateur result = (Utilisateur) getSession()
.merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Utilisateur instance) {
log.debug("attaching dirty Utilisateur instance");
try {
getSession().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Utilisateur instance) {
log.debug("attaching clean Utilisateur instance");
try {
getSession().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
} |
Partager