One of the main points to the session facade
is to wrap a group of entity operations in one
transaction local to the server. The session facade
starts the transaction.
Use Required on all methods in the facade to achieve
Technically the spec says you have to declare the
transactions for a session bean. JBoss defaults to
Required if you forget.
For portability make it explicit.
Thanks for your reply.
What about if I have a method on a session (stateless) that executes some SQL on the server, then creates an entity bean.
The situation I am talking about is for logging, we only want to record the last 300 activities so I create the activity using an entity bean then I execute some SQL.
Do I have to wrap my SQL/JDBC call in it's own transaction or is this magically done for me?
Assuming you are using a managed connection
(from your configured DataSource in JNDI) to
perform your SQL, JBoss will associate the connection
with the transaction the session bean started.