Results 1 to 5 of 5

Thread: EJB transaction and Spring templates

  1. #1
    Join Date
    Aug 2004
    Posts
    12

    Default EJB transaction and Spring templates

    Hi,
    Can I use jdbcTemplate or HibernateTemplate or support under SLSB transaction hood? ( for example company need expose to remote EJB client), I like the spring handle exception.


    Ping

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

    Default

    Yes. You could also consider using Spring tx mgt and making the bean BMT, but you can use EJB CMT fine.
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

  3. #3
    Join Date
    Aug 2004
    Posts
    12

    Default

    I like your second suggestion, you know "political" presure to use EJB, so I can used "EJB" with everything spring under it.

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

    Default

    EJB remoting + Spring declarative tx mgt works very well. That way you get Spring's "rollback rule" support, meaning that automatical rollback can work for checked exceptions without propagating an EJBContext through POJO delegates, making them harder to test. Less invasive: transaction management is purely driven through pure Java message signatures.
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

  5. #5

    Default

    The only ramification I have encountered to using the BMT approach is that your EJB will not be able to be called by another EJB and participate in that bean's transaction. In the section on bean-managed transaction demarcation the EJB spec says "When a client invokes a business method via the enterprise bean’s home or component interface, the Container suspends any transaction that may be associated with the client request."
    In my testing, if I had a CMT bean call my Spring transaction bean fronted by a BMT, a rollback initiated in the called bean did not cause a rollback of the caller. This may or may not be an issue for you.
    If my understanding of the scenario is not correct, please let me know.

Similar Threads

  1. Unit testing with JOTM and JtaTransactionManager
    By lalle in forum Architecture
    Replies: 1
    Last Post: Oct 15th, 2005, 09:05 AM
  2. Replies: 0
    Last Post: Jun 6th, 2005, 06:22 AM
  3. Spring code remarks
    By Alarmnummer in forum Architecture
    Replies: 18
    Last Post: Apr 7th, 2005, 07:17 AM
  4. Replies: 3
    Last Post: Nov 19th, 2004, 07:16 PM
  5. Transaction pb Hibernate/MySQL
    By syluser in forum Data
    Replies: 2
    Last Post: Aug 28th, 2004, 02:40 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
  •