Grails
  1. Grails
  2. GRAILS-8824

Allow AbstractPersistenceEventListener to be set with a null datasource

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0.1
    • Fix Version/s: None
    • Component/s: Persistence
    • Labels:
      None
    • Environment:
      All

      Description

      Currently, you need to pass in a datasource into AbstractPersistenceEventListener constructor, otherwise a NullPointerException is raised.

      The documentation states that you should be able to just add a listener without a datasource.

      def init =

      { applicationContext.addApplicationListener(new MyPersistenceListener()) }

      This case should be supported.

        Activity

        Tomas Lin created issue -
        Tomas Lin made changes -
        Field Original Value New Value
        Status Open [ 1 ] Edit [ 10000 ]
        Description Currently, you need to pass in a datasource into AbstractPersistenceEventListener constructor, otherwise a NullPointerException is raised.

        The documentation states that you should be able to just add a
        Currently, you need to pass in a datasource into AbstractPersistenceEventListener constructor, otherwise a NullPointerException is raised.

        The documentation states that you should be able to just add a listener without a datasource.

        def init = {
            applicationContext.addApplicationListener(new MyPersistenceListener())
        }

        This case should be supported.
        Graeme Rocher made changes -
        Fix Version/s 2.0.2 [ 13064 ]
        Graeme Rocher made changes -
        Fix Version/s 2.0.3 [ 13094 ]
        Fix Version/s 2.0.2 [ 13064 ]
        Graeme Rocher made changes -
        Fix Version/s 2.0.4 [ 13099 ]
        Fix Version/s 2.0.3 [ 13094 ]
        Hide
        Aaron Long added a comment -

        As a workaround, you can get the list of datastores out of the application context using:

        grailsApplication.mainContext.eventTriggeringInterceptor.datastores

        Show
        Aaron Long added a comment - As a workaround, you can get the list of datastores out of the application context using: grailsApplication.mainContext.eventTriggeringInterceptor.datastores
        Hide
        Graeme Rocher added a comment -

        You'd be better off with "applicationContext.getBeansOfType(Datastore)"

        Show
        Graeme Rocher added a comment - You'd be better off with "applicationContext.getBeansOfType(Datastore)"
        Graeme Rocher made changes -
        Status Edit [ 10000 ] Open [ 1 ]
        Graeme Rocher made changes -
        Priority Major [ 3 ] Minor [ 4 ]
        Jeff Scott Brown made changes -
        Fix Version/s 2.2 [ 13093 ]
        Fix Version/s 2.0.4 [ 13099 ]
        Graeme Rocher made changes -
        Fix Version/s 2.3 [ 13311 ]
        Fix Version/s 2.2-RC1 [ 13093 ]
        Graeme Rocher made changes -
        Fix Version/s 2.3-M2 [ 13457 ]
        Fix Version/s 2.3-M1 [ 13311 ]
        Graeme Rocher made changes -
        Fix Version/s 2.3-RC1 [ 13458 ]
        Fix Version/s 2.3-M2 [ 13457 ]
        Graeme Rocher made changes -
        Fix Version/s 2.3-RC2 [ 13482 ]
        Fix Version/s 2.3-RC1 [ 13458 ]
        Graeme Rocher made changes -
        Fix Version/s 2.3.1 [ 13502 ]
        Fix Version/s 2.3-RC2 [ 13482 ]
        Graeme Rocher made changes -
        Fix Version/s 2.3.1 [ 13502 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Tomas Lin
          • Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Development