Announcement Announcement Module
No announcement yet.
EJB to Spring transaction config question Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • EJB to Spring transaction config question

    I am currently moving an app from using EJB's to POJO's. The SLSB's use DAO's/Hibernate for data access via JTA configured in Hibernate. It's worked great so far. But In order to configure JTA in Spring for this, is the following sufficient? -

    BTW - I'm not using any of Springs Hibernate stuff (template, etc...). The DAO's use the HibernateUtil class provided in the CaveatEmptor sample.

    From config file-

    <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTran sactionManager"/>

    <bean id="mapService" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager"><ref bean="transactionManager"/></property>
    <property name="target">
    <bean id="mapServiceTarget" class=" pl"/>
    <property name="transactionAttributes">
    <prop key="*">PROPAGATION_REQUIRED</prop>

    To answer my own question - it appears to work (not thouroughly tested yet). The main reason I'm asking is because I've run into a strange problem with one area of the application after switching to Spring transactions which is related to the switch but I'm not sure why. Is there anything else I may be missing in the configuration?

  • #2
    Your config seems fine. Please be more specific about the problem you're encountering.


    • #3
      I found the source of the trouble. I had a reference to a non-transactional bean that was causing my problems. The bean was instantiated in the code instead of Spring managed. All of the refactoring I'm doing has muddied the code somewhat. Transactions seem to work fine now.