gavin wrote:
If you are in a CMT environment, you should no longer need Spring. AFAICT, people use spring here for four things:
(1) session handling/flushing
(2) transaction management
(3) SQLException mapping
(4) Runtime exceptions model
Well, with hibernate.transaction.flush_before_completion and hibernate.transaction.auto_close_session, (1) is now much, much easier. (2) is handled by CMT. (3) is implemented in the Hibernate Dialect. And Hibernate3 has an unchecked exception model, so (4) is no longer relevant.
Given that I am used to calling hibernate from Spring, I am used to having a Spring applicationContext.xml file.
I've just converted a simple project to use hibernate.cfg.xml
My application code currently is implemented in clsses that extend Spring's HibernateDaoSupport class. So for instance, to save something I do:
getHibernateTemplate().saveOrUpdate(instance);
I am not used to doing anything with sessions or transactions as a result of the reliance on Spring.
Is there any example code of an absolutley minimal Hibernate 3 that does the same as above, running in a CMT ?
Basically I would like to know how to convert my Spring based hibernate 2 methods to plain Hibernate 3.
Any pointers greatly appreciated.