CreateSqlQuery retourne nullpointerexception
Salut à tous et à toutes.
dans mon programme j'utilise hibernate 3 et j'essai de selectionner un client par son num d'itentite.
Voila la methode qui fait ça mais malheuresement ça me retourne null pointer exception meme si l'enregistrement figure dans la base de donnees.
Code:
1 2 3 4 5 6 7 8 9 10
|
public static Physique getpclientbycin(String cin){
Physique p=null;
try {
Session session = HibernateUtil.currentSession();
p=(Physique) session.createSQLQuery("select * from instruction_credits.Physique where cin='"+cin+"'").list().get(0);
} catch (Exception e) {
e.printStackTrace();
}
return p; |