67,512
社区成员
发帖
与我相关
我的任务
分享
public void mytest(){
List l = findfield("from student.hibernate.db.Student");
System.out.println("--------------------------------------------");
for(int i = 0;i<l.size();i++){
System.out.println(l.get(i));
}
System.out.println("--------------------------------------------");
}
//修改
public boolean update(Object obj) {
mytest();
boolean flag=true;
Transaction tx = null;
try {
tx = session.beginTransaction();
session.update(obj);
tx.commit();
}
catch (HibernateException he) {
if (tx!=null)
tx.rollback();
flag=false;
throw he;
} catch ( Exception ex) {
}
return flag;
}
public void mytest(){
List l = findfield("from student.hibernate.db.Student");
System.out.println("--------------------------------------------");
for(int i = 0;i<l.size();i++){
System.out.println(l.get(i));
}
System.out.println("--------------------------------------------");
}
//修改
public boolean update(Object obj) {
mytest();
boolean flag=true;
Transaction tx = null;
try {
// tx = session.beginTransaction();
// session.update(obj);
// tx.commit();
}
catch (HibernateException he) {
if (tx!=null)
tx.rollback();
flag=false;
throw he;
} catch ( Exception ex) {
}
return flag;
}