Announcement Announcement Module
Collapse
No announcement yet.
BMP Entity Bean with Spring + iBATIS Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • BMP Entity Bean with Spring + iBATIS

    Hi, i have a question about transactions.
    Suppose i have BMP entity beans, persisted using iBATIS with a DataSource configured with Spring's IOC. Is it possible to use the Application Server's declarative transaction (either locar or global) demarcation with this configuration?

    Thanks

  • #2
    I know it's possible with SLSBs - I'm using those as a Facade for Spring/Hibernate DAOs that are POJOs. I don't see why it would be any different for BMP. See my post in the forum with regard to the solution.

    Lou

    p.s. Why are you using BMP? It's pretty heavy weight as opposed to POJOs.

    Comment


    • #3
      Loumeister, could you post a link to the post you are refering to?
      I'm not really winlling to implement BMP but just was considering as an alternative.

      I'm seriously thinking about the possibility of not using EJBs at all or just SLSBs as facades. Even with the latter configuration, is it possible to use container transaction demarcation and DAOs with a datasource defined with Spring's IOC?

      Comment


      • #4
        I'm seriously thinking about the possibility of not using EJBs at all or just SLSBs as facades. Even with the latter configuration, is it possible to use container transaction demarcation and DAOs with a datasource defined with Spring's IOC?
        You can use EJB CMT in combination with Spring data access (JDBC, iBATIS/whatever).

        Suppose i have BMP entity beans, persisted using iBATIS with a DataSource configured with Spring's IOC
        If you want to use EJB CMT you need the app server to manage the DataSource (via JNDI). You could use Spring data access to make the DataSource available to application code, using JndiObjectFactoryBean.

        I've very seldom seen a legitimate use for BMP, where it adds value compared to just doing the underlying data access without the BMP layer.

        Comment


        • #5
          Originally posted by ndijkstra
          Loumeister, could you post a link to the post you are refering to?
          Yes, check out this thread in the Hibernate Forums: http://forum.hibernate.org/viewtopic.php?t=929516

          We use SLSB+BEA CMT+Spring+Hibernate all very easily. SLSB is our business tier; CMT gives us tx demarcation; Spring gives us Session-per-transsaction management transparently and AOP; Hibernate persistence.

          HTH,
          Lou

          Comment


          • #6
            Hi Lou,
            i've been watching your post and there's something i don't understand. Why did you use
            <property name="hibernate.transaction.manager_lookup_class">
            net.sf.hibernate.transaction.WeblogicTransactionMa nagerLookup
            </property>
            in hibernate's configuration?

            If i use in hibernatel.cfg.xml
            Code:
               <property name="hibernate.transaction.factory_class"> 
                     net.st.hibernate.transaction.JTATransactionFactory 
               </property>
            and in applicationContext.xml
            Code:
               <bean id="myDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
                   <property name="jndiName"><value>jdbc/myDataSource</value></property> 
               </bean> 
            
               <bean id="mySessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean"> 
                  <property name="dataSource"> 
                     <ref local="myDataSource"/> 
                  </property> 
                  <property name="configLocation"> 
                     <value>classpath&#58;hibernate.cfg.xml</value> 
                  </property> 
               </bean>
            won't i be able to delegate transaction demarcation to the one declared in my CMT Beans?

            Comment


            • #7
              You need to use that to tie Hibernate to vendor implementation of CMT. Hibernate offers such a manager look-up for WebSphere, BEA, etc. Check out their documentation if you have a different app server. I believe JTATransactionFactory would be used if you were using Spring to demarcate transactions, which is also a viable option as well.

              Lou

              Comment

              Working...
              X