Results 1 to 7 of 7

Thread: BMP Entity Bean with Spring + iBATIS

  1. #1
    Join Date
    Sep 2004
    Location
    Argentina
    Posts
    23

    Default 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
    - N!K -

  2. #2
    Join Date
    Aug 2004
    Posts
    218

    Default

    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.

  3. #3
    Join Date
    Sep 2004
    Location
    Argentina
    Posts
    23

    Default

    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?
    - N!K -

  4. #4
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    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.
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

  5. #5
    Join Date
    Aug 2004
    Posts
    218

    Default

    Quote 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

  6. #6
    Join Date
    Sep 2004
    Location
    Argentina
    Posts
    23

    Default

    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?
    - N!K -

  7. #7
    Join Date
    Aug 2004
    Posts
    218

    Default

    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

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. could not satisfy dependencies
    By springuser in forum Container
    Replies: 4
    Last Post: Apr 26th, 2005, 01:15 PM
  5. Replies: 1
    Last Post: Apr 25th, 2005, 07:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •