This discussion is archived
1 Reply Latest reply: Apr 10, 2012 8:05 PM by ArunBodap RSS

Entity bean creates a transaction when reading from the database?

929017 Newbie
Currently Being Moderated

I have a stateless session bean which uses a BMP entity bean to retrieve data from the database.

My stateless session bean has a method load() which calls getValues() on the entity bean.

Analyzing logs and stepping thru the code, I found out that each and every getValues() call is demarcated by a transaction. I also know that the calling method load() is not in a transaction (used the TransactionHelper to figure that out). Basically a new transaction is created when getValues() is called, and committed when getValues() call is done.
I was under the impression that transactions are required only when data is written to a database (eg setValues()) but not when you read it. Even more, I have set the transaction attribute to "Never", and I am not getting any exceptions as I would have expected.

Am I doing something wrong in my setup or this is the expected behavior of the entity beans?

Here is the ejb-jar.xml config related to my question:




Thank you for your help,


  • Correct Answers - 10 points
  • Helpful Answers - 5 points