[jboss-user] [EJB/JBoss] - Re: tx attributte - supports doesn't work as expected

jaikiran do-not-reply at jboss.com
Sun Jun 3 13:43:44 EDT 2007


anonymous wrote : EntityManager must be access within a transaction

Which means that when you are accessing the entity manager in your createAirport method, there should be an active transaction. As you already correctly mentioned:
anonymous wrote : 
  | As you can see I configured it with SUPPORTS transaction attribute, so when there is a transaction all methods in my bean will use it, when there is no transaction context then bean wouldn't begin a new one

I believe when the createAirport method is being called, there is no active transaction and since the transaction attribute that you have specified is SUPPORTS, the server wont create a new one. You might want to change the transaction attribute to REQUIRED instead of SUPPORTS. For transaction attribute REQUIRED, a new transaction is created when there is no active transaction. If there is a active transaction then the same will be used for that method. So try changing 

anonymous wrote : @TransactionAttribute(TransactionAttributeType.SUPPORTS)
 
to 

@TransactionAttribute(TransactionAttributeType.REQUIRED)

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

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



More information about the jboss-user mailing list