5 Replies Latest reply on Oct 28, 2005 4:15 PM by T T

    How to set Listener to Hibernate?

    T T Newbie

      I'm using one of the latest builds of jBPM and I use a ContextFilter that starts the contextBuilder.begin(); then chains the request and then does contextBuilder.end();

      After beginning the contextBuilder, I try to do something like this:

      HibernateContext.getConfiguration().setListener("load", new JaasLoadListener() );

      But it seems that the Listener is not used, is there any better way to hook the listener into place? In my jUnit it works when I connect the Listener to the session (not using the HibernateContext)

        • 1. Re: How to set Listener to Hibernate?
          T T Newbie

          ah, I should add that I already figured out I first had to set


          Otherwise, I couldnt even get the Configuration

          • 2. Re: How to set Listener to Hibernate?
            T T Newbie

            argggg, why can I not post xml-tags here or even edit my post?

            [property name="isConfigurationLookupEnabled"][boolean]true[/boolean][/property]

            • 3. Re: How to set Listener to Hibernate?
              Ronald van Kuijk Master

              put it in code tags so a left square bracket 'code' right suqare bracket and closing it with a slash in it. This gives you

              <heee>this works</heee>

              • 4. Re: How to set Listener to Hibernate?
                T T Newbie

                I guess I am halfway a solution now


                 <!-- singleton interceptors beans definitions -->
                 <bean name="HibernateSessionFactoryInterceptor" singleton="true" class="org.jbpm.tc.hibernate.HibernateSessionFactoryInterceptor" >
                 <property name="cfgXmlResource"><string>org/jbpm/tc/hibernate/asvz.hibernate.cfg.xml</string></property>
                 <property name="isConfigurationLookupEnabled"><boolean>true</boolean></property>

                 <session-factory >
                 <!-- listeners -->
                 <listener type="load" class="nl.asvz.security.hibernate.JaasLoadListener"/>

                Now the problem is this:

                Caused by: org.hibernate.MappingException: Unable to instantiate specified listener class: JaasLoadListener
                at org.hibernate.cfg.Configuration.setListeners(Configuration.java:1487)

                • 5. Re: How to set Listener to Hibernate?
                  T T Newbie

                  oops, I didnt set the full path in the hibernate.xml.cfg that was being used....
                  further with debugging!