[jboss-user] [JBoss Seam] - s:link jta - transaction, rollbackonly
motte1979
do-not-reply at jboss.com
Wed Aug 29 06:24:13 EDT 2007
Hi !
Im using s:link with @DataModelSelection to delete an entity.
<a jsfc="s:link" value="#{messages['action.delete']}" action="#{labelFilter.delete}"/>
If i have opened two pages with the same content and simulate simultan user-action 'delete' on the same entity, i got an OptimisticLockException on flush.
@TransactionAttribute (TransactionAttributeType.REQUIRES_NEW)
| public void delete(EmonitorEntity entity) {
| try {
| this.entityManager.remove(entity);
| this.entityManager.flush();
| } catch (OptimisticLockException ole) {
| if (sessionContext.getRollbackOnly())
| logger.info("rollbackonly", ole);
| }
| }
The transaction (the new one) should have been rolled back after processing this method (because i'm using CMT which is default). This seems to be done correctly. Afterwards i'm raising an event to a PAGE-scoped component to refresh it's contents. But the refresh does not work because the transaction
has been set to 'rollbackonly'.
public Long size(Class<?> clazz, String[] properties, Object[] values) {
| Query q = getSizeQuery (clazz, properties, values);
|
| if (sessionContext.getRollbackOnly())
| logger.fatal("rollbackonly", new AssertionError());
|
| try {
| return ((Number) q.getSingleResult()).longValue();
| } catch (RuntimeException rte) {
| throw rte;
| }
| }
This all is processed in the RENDER_RESPONSE_PHASE of jsf.
| * Does seam work correctly with @TransactionAttribute ?
| * I've spawn a new transaction for the delete-method, why does this effect the RENDER_RESPONSE-PHASE - transaction of seam?
|
| Thanks for your help! Hints are welcome ...
|
| Using :
|
| | * seam 2.0.0.BETA1 from cvs
| | * hibernate 3
| | * jboss 4.2.0.GA
| |
|
| Please let me know, if you need more informations.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079079#4079079
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079079
More information about the jboss-user
mailing list