Where are you running this code.
If you run this code in the context of an existing transaction it will use only 
one sql query.  If the code is being executed without an existing transaction 
each get method would lead to a new transaction being started and committed 
once the get method is completed.  

You should wrap access to your entity beans within a stateless session bean 
(facade pattern). The stateless session bean methods should be setup with 
transaction attribute required.  

The updates will cause even serious problems, if you are trying to set two 
attributes each one will happen in a separate transaction.  The first set will 
go through regardless of what happens to the second one.

You should use a stateless session bean method to combine these operations and 
ensure that they happen in a single transaction.

Also it is a good practice to set the transaction attribute for entity beans to 
mandatory.  This will prevent them from being used outside of a transaction, 
which can have very serious performance & functional problems

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3867898#3867898

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3867898


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to