• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HibernateTemplate does not commit to mysql database on saveOrUpdate

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic