Package com. mysurvey. Dao. impl;
Import org. hibernate. sessionfactory;
Import org. springframework. Orm. hibernate3.support. hibernatedaosupport;
Import com. mysurvey. Bean. user;
Import com. mysurvey. Dao. userdao;
Public class userdaoimpl extends hibernatedaosupport implements userdao {
Private sessionfactory;
String SQL = "from user u where u. Username =? ";
Public user query (string name ){
// Todo auto-generated method stub
User user = NULL;
If (this. gethibernatetemplate (). Find (SQL, name) = NULL ){
User = NULL;
} Else {
User = (User) This. gethibernatetemplate (). Find (SQL, name). Get (0 );
}
Return user;
}
Public void Delete (User user ){
// Todo auto-generated method stub
This. gethibernatetemplate (). Delete (User );
}
Public void insert (User user ){
// Todo auto-generated method stub
This. gethibernatetemplate (). Save (User );
}
Public void Update (User user ){
// Todo auto-generated method stub
This. gethibernatetemplate (). Update (User );
}
}
Because the red partCodeNo get (0); Result error. After checking, the user in the list cannot be transformed like a single user object.