Uploaded image for project: 'Spring Data JPA'
  1. Spring Data JPA
  2. DATAJPA-724

JPA named query lookup causes rollback transaction in an EJB container

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Works as Designed
    • Affects Version/s: 1.8 GA (Fowler)
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None
    • Environment:
      WildFly 8.2, JTA

      Description

      Using Spring Data JPA repositories in an EJB environment causes rollback of the current database transaction. While resolving the query at it's first call JpaQueryLookupStrategy throws and catches an IllegalStateException when no named query is defined:

      try {
      	return lookupStrategy.resolveQuery(method, em, namedQueries);
      } catch (IllegalStateException e) {
      	return createStrategy.resolveQuery(method, em, namedQueries);
      }
      

      IllegalStateException extends RuntimeException and is in this way a system exception as defined in JTA definition. A system exception causes to rollback the current container managed transaction. The later executed query causes then
      java.sql.SQLException: javax.resource.ResourceException: IJ000460: Error checking for a transaction (in WildFly). It would be better to avoid throwing a runtime exception while resolving the query.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                olivergierke Oliver Drotbohm
                Reporter:
                gunther Gunther v. Wolffersdorff
                Last updater:
                Jens Schauder
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: