Grails
  1. Grails
  2. GRAILS-8671

Grails Services don't have transactional state across service calls

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0 final
    • Fix Version/s: None
    • Component/s: Services
    • Labels:
      None

      Description

      Grails documentation states that any service defined under "services" package path has it's transactional state set to true by default. However if any method marked with a @PreAuthroize annotation that verifies whether roles or privileges of a user to perform read/write operation is called before a method call an org.hibernate.LazyInitialization exception is thrown because the Session is closed. This issue still occurs intermittently once explicitly adding "static transactional = true" to the service class.

      On utilizing spring's @Transactional annotation at the class or method level of the service class this issue goes away. The org.grails.plugins.springsecurity.service.acl.AclUtilService class where the roles and permissions check occurs via spring's expression language (in the @PreAuthorize annotation) has it's transactional state set to true by default i.e. implicitly. This means that the calling service's transactional state being true implicitly or explicitly vie Grails semantics does not work. When utilizing Spring's transactional semantics from the calling service then it works as expected.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Bisrat Dinka
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development