MyEclipse Hibernate Spring tutorial – Managing Hibernate transaction in Spring

Spring transaction management, Hibernate transaction management in Spring

There was a problem/defect in the MyEclipse tutorial on Hibernate Spring. It was not a major problem. The tutorial demonstrates the Spring and Hibernate functionality pretty well. The only problem was that the code does seems to work properly. Because of absence of proper transaction management in code the data was not getting persisted in the database. Because of the caching in Hibernate it seems to the user that the data is being written to the database and then read back.

There are two solutions to the problem. One is to write the transaction management code in the java class itself. Another is to manage transaction via Spring’s transaction management. The second solution makes more sense because it shows of the Spring’s capability of managing transaction in Hibernate. You can see both the solutions here.

I am writing the Spring’s configuration for Hibernate transaction management again.
[sourcecode language=’xml’]



2 thoughts on “MyEclipse Hibernate Spring tutorial – Managing Hibernate transaction in Spring

  1. Nise Duram

    thanks for ur code.
    Faulty/incomplete code only wasted 3 days of mine and gave me unbearable grief.

    thanks again.

  2. Nish

    Its all working now .. I am able to persist data…

    The problem that I am facing now is
    lets assume I have 10 tables in the postgres database that I am trying to load

    beanFactory = new XmlBeanFactory(new ClassPathResource(
    now it creates 10 separate postgres process in the task manager .. I am unable to close the connection once I have checked out the product using my webflow..
    do you think Iam missing out on anything .. here

    I have built on the sample code provided by eclipse and your insight above..

    kindly advice


Leave a Reply

Your email address will not be published. Required fields are marked *