• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

JDBC transactions in EJB 2.0

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

This is my first post in code ranch!

I am using EJB 2.0 for coding my business logic and use entity beans for persistence.
But I have few business methods in stateless session beans, which uses JDBC queries.
I am using the default transactional attribute "Required".

The connection are retrieved from the data source deployed in the application server.
My concept(s) regarding JDBC when it is used in EJBs are:

1. When connection is retrieved from data source in EJB method, the executed SQL
queries form part of the transactions initiated by the container for the EJB method.
2. When a system exception is thrown the transaction will be rolled back by the container.

Now the issue is that the transaction rollback is not happening if SYSTEM exception is thrown in between.
I tried setting the attribute to "RequiresNew" for the EJB method to initiate new transaction, but still not working.
Could anyone point out, whether my understanding is right, or what I am doing wrong.


Thanks in advance,
Raj.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which application server (which version) and which database server are you using?
 
Raj Shenoy
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jaikiran,

I am using Jboss 4.0.4.GA and MySQL 5.1.50.


Regards.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Raj Shenoy wrote:MySQL 5.1.50.


MySQL has 2 different engines. InnoDB and MyISAM http://dev.mysql.com/doc/refman/5.1/en/storage-engines.html. Only InnoDB supports transactions. So make sure that you have configured your DB tables to use InnoDB. Check the MySQL manual for more details.
 
Raj Shenoy
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Would be grateful for any suggestions, pointers.


Regards.
 
Raj Shenoy
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi JaiKiran,

I didn't refresh the page, and hence posted last message.
Really thankful for your quick reply. Yes we use MyIsam engine.
I guess now I have my answer to further research on!


Thanks once again.
Regards.
 
Heroic work plunger man. Please allow me to introduce you to this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic