hibernate事务提交问题~~急急急
请大家帮帮忙:
Session session = this.getSession();
Transaction tx = session.beginTransaction();
try{
。。。
for(int i =0;i<len;i++){ //len<10
dto.setColorname(colorName);
session.save(dto);
session.flush();
session.evict(dto);
}
tx.commit();
}catch(HibernateException e){
if (null != tx) {
tx.rollback();
}
throw e;
}finally{
session.close();
}
报错:org.hibernate.TransactionException: Transaction not successfully started 困扰半天了~请大家帮忙,先谢了