/**
* 添加站点纪录
* @param _site
* @return
*/
public boolean addSite(Site _site) {
Site site = (Site) _site;
Session sess = null;
Transaction tx = null;
try {
sess = HibernateUtil.currentSession();
tx = sess.beginTransaction();
sess.save(site);
tx.commit();
//log
logger.info("add site success!");
return true;
} catch (HibernateException he) {
if ( tx != null ) tx.rollback();
//log
logger.error("(@@@@@@@@@@@ add site error!@@@@@@@@@@@)", he);
new org.hibernate.HibernateException("addSite("+_site+"):"+listErrors);
return false;
} finally {
try {
HibernateUtil.closeSession();
} catch (HibernateException he) {
new org.hibernate.HibernateException(
"HibernateUtilServlet.closeSession()");
}
}
}
二 set里 可以配置成on-to-many 一般是主从表