• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HibernateTemplate does not commit to mysql database on saveOrUpdate

 
matt kjent
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have worked on web applications for about 2 years as a developer and now I am setting one up myself using new versions of Spring and Hibernate using annotations with a mysql database.

So basically, I am a novice when It comes to setting up Spring and higher level Hibernate.

My problem is that when using HibernateTemplate.saveOrUpdate() , the insert is cached somewhere so that getHibernateTemplate().find("from "+clazz.getName()) gets the newly created value, but it is not actually inserted into the mysql.

I have experimented with using


which does commit to the database, but I think it would be good to not have to explicitly handle the transactions myself (declarative transactions?)

I am a bit puzzled because the insert statement is output to my log I get no error and no combination of options seem to work.

ApplicationContext.xml (ref in web.xml)

You may suggest an improvement to my design, but I am quite keen on annotations and hibernate's auto schema creation.

Thanks in advance!

-Matt



hibernate.cfg.xml



My generic DAO



an example of an annotated domain object



domain object superclass


 
matt kjent
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This was solved by putting my hibernate config inline in the spring config

It would be nice to know why that worked.

-Matt

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic