facebook

Spring and Hibernate tutorial

  1. MyEclipse Archived
  2.  > 
  3. Documentation
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #309893 Reply

    anjanb
    Member

    Hi There,

    I am using myeclipse 8.6 M2 and was trying out http://www.myeclipseide.com/documentation/quickstarts/hibernateandspring/.

    It went just fine.

    However, the records were NOT getting committed to the DB. So, I went looking. http://forum.springsource.org/showthread.php?p=309568&posted=1#post309568

    I posted on the forum and got the answer.

    Suggest that the sample code use the following tips so that records are committed.
    1) Use an ApplicationContext instead of a BeanFactory
    2) You aren’t programming to interfaces so you must use classproxies (or better still use Interfaces)

    BR,
    ~A

    #309894 Reply

    anjanb
    Member

    Just to be sure, I modified the spring config file and added
    <tx:annotation-driven />

    <bean id=”transactionManager”
    class=”org.springframework.orm.hibernate3.HibernateTransactionManager”>
    <property name=”sessionFactory” ref=”sessionFactory” />
    </bean>

    Since I had chosen to use Annotations while doing the exercise, I had to add
    @Transactional annotations to the class and methods of the DTO to get things working.

    But adding the annotation and the above config changes were not enough.

    I had to
    1) convert DTO and entities to use interface
    2) replace the BeanFactory to use ApplicationContext.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Spring and Hibernate tutorial

You must be logged in to post in the forum log in