- 论坛徽章:
- 0
|
举个 获取对象(传递对象编码)的例子
/*********************************************************************************************
* Function Name : 传递企业id获得该对象.
* Return Value : PO
* Creator : zhuwq
* Create Time : 2006/02/28
* Modify Time :
**********************************************************************************************/
public GxCrmProjectPO getPOById(int id) throws
HibernateException, Exception {
Session s = this.beginTransaction();
GxCrmProjectPO po = null;
try {
Query q = s.createQuery(
"from GxCrmProjectPO as gcpo where gcpo.id=:id");
q.setInteger("id", id);
Iterator it = q.iterate();
while (it.hasNext()) {
po = (GxCrmProjectPO) it.next();
}
this.endTransaction(true);
}
catch (Exception ex) {
System.out.println("GxCrmProjectBO.GxCrmProjectBO Method Failure: " +
ex.getMessage());
this.endTransaction(false);
}
return po;
} |
|