[jboss-user] [JBoss Seam] - Recovering from a Constraint violation exception
wise_guybg
do-not-reply at jboss.com
Tue Sep 18 10:40:56 EDT 2007
Hi,
I have an application using Seam 2.0.0.B1. A colleague was complaining that he cannot recover from a ConstraintViolationException. On a certain string field in the database there is a unique constraint. When the user tries to enter an existing value the database checks the constraint and an exception is fired. I believe this causes a rollback and closes the current transaction. After that it is impossible to work with the database. We have tried to request a new transaction so that we can reload the data that causes problems but we always receive errors about the transaction not being active:
Caused by: java.sql.BatchUpdateException: ORA-00001: unique constraint (EXAM_CENTER.UK_EXAM_VENDOR_NAME) violated
| WARN [JDBCExceptionReporter] SQL Error: 1, SQLState: 23000
| 17:29:34,562 ERROR [JDBCExceptionReporter] ORA-00001: unique constraint (EXAM_CENTER.UK_EXAM_VENDOR_NAME) violated
| 17:29:34,562 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
|
| ...
|
| javax.faces.el.EvaluationException: javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: Cannot open connection
| at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
| at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
|
| ...
|
| Caused by: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImple < ac, BasicAction: af42a1f:a6a:46efb7c6:728 status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: af42a1f:a6a:46efb7c6:728 status: ActionStatus.ABORT_ONLY >)
| at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)
| at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:47)
| at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
| ... 147 more
| Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: af42a1f:a6a:46efb7c6:728 status: ActionStatus.ABORT_ONLY >
| at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:304)
Have any of you had any experience in handling constraints with EJB3 and/or Seam? What am I supposed to do to recover from the exception and create a new transaction/session?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085547#4085547
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085547
More information about the jboss-user
mailing list