Hibernate version:
3.2
I used hbm2dao to generate my DAO PersonHome.java, and I assume the following method is to create/persist a new Person into the database:
Code:
public void persist(Person transientInstance) {
log.debug("persisting Person instance");
try {
sessionFactory.getCurrentSession().persist(transientInstance);
log.debug("persist successful");
}
catch (RuntimeException re) {
log.error("persist failed", re);
throw re;
}
}
However, I get the following exception:
Code:
org.hibernate.HibernateException: persist is not valid without active transaction
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
at $Proxy0.persist(Unknown Source)
at org.vinotrails.model.dao.PersonHome.persist(PersonHome.java:39)...
I understand (from the example) that you should call beginTransaction() on the session before calling save(). So how is the persist() method supposed to function in this generated DAO?
Furthermore, is there documentation on what the generated methods in this PersonHome class are supposed to do exactly, such as attachDirty, attachClean, merge?
Thanks.