2 Replies Latest reply on Jun 2, 2009 9:15 AM by bdaw

    Setting user's roles doesn't trigger Hibernate PreInsert or

    johnnythehun

      I am using JBoss Portal 2.7.0 CR1 on Windows, JDK5

      I am logging JBoss Portal Admin usage via Hibernate Event listeners.

      I have added the listeners to server\default\deploy\jboss-portal.sar\conf\hibernate\user\hibernate.cfg.xml:

      <listener type="pre-update" class="mypackage.HibernateAuditLogListener"/>
       <listener type="pre-delete" class="mypackage.HibernateAuditLogListener"/>
       <listener type="pre-insert" class="mypackage.HibernateAuditLogListener"/>
       <listener type="pre-load" class="mypackage.HibernateAuditLogListener"/>
      


      I am able to catch User creation, modification, Role creation modification etc.

      But my PreUpdateListener or my PreInsertListener does NOT fire if I add a Role to a user's roles through the admin page:
      Members -> User management -> search users -> roles -> ...select roles.... -> submit

      Why doesn't my HibernateEventListener get fired when JBoss Portal saves the roles? How can I log setting the roles of a user?

      Thanks,
      John

        • 1. Re: Setting user's roles doesn't trigger Hibernate PreInsert
          johnnythehun

          Thank you for your quick answer, your solution is good too, if the hibernate listener approach doesn't work.

          I have tested the hibernate listener method and found that the following actions do not trigger a hibernate pre event:

          - adding roles to a user

          - adding / setting / changing a page's display name

          - setting the theme (layout, renderset etc) of a page

          - adding / setting / changing a page's properties


          Can anyone tell me how to catch these events?

          Thanks,
          John

          • 2. Re: Setting user's roles doesn't trigger Hibernate PreInsert
            bdaw

            Look at org.jboss.portal.identity.event package.
            Then event service is registered in jboss-service.xml:

            <mbean de="org.jboss.portal.identity.service.IdentityEventManagerService"
            name="portal:service=IdentityEventManager" ...