//判断是操作员是否存在
public Toperator isOperator(String operatorName, String operatorPwd) {
Toperator operator=null;
Session session=factory.openSession();
Transaction ts=session.beginTransaction();
Query query=session.createQuery("from Toperator t where t.operatorName='"+operatorName+"' and t.operatorPwd='"+operatorPwd+"'");
List list=query.list();
Iterator it=list.iterator();
if(it.hasNext()){
operator=(Toperator)it.next();
}
ts.commit();
session.close();
return operator;
}
public Toperator isOperator(String operatorName, String operatorPwd) {
Toperator operator=null;
Session session=factory.openSession();
Transaction ts=session.beginTransaction();
Query query=session.createQuery("from Toperator t where t.operatorName='"+operatorName+"' and t.operatorPwd='"+operatorPwd+"'");
List list=query.list();
Iterator it=list.iterator();
if(it.hasNext()){
operator=(Toperator)it.next();
}
ts.commit();
session.close();
return operator;
}