title: Declaring Hibernate event listeners in a JPA environment
body: <p>Hy guys,</p>
  
  <p>I am working on a project developed in Java EE 5 environment. I want to know how I can declare a Hibernate event listener so that I can be informed when CRUD operation are performed.</p>
  
  <p>I've read that I must  declare in the Hibernate configuration file <code>*cfg.xml</code> something like this:</p>
  
  <pre><code>&lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          ...
          &lt;event type="load"&gt;
              &lt;listener class="com.eg.MyLoadListener"/&gt;
              &lt;listener class="org.hibernate.event.def.DefaultLoadEventListener"/&gt;
          &lt;/event&gt;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>The problem is I don't have such a file in the project. We are using JPA (with Hibernate as the underlying implementation). Do you know if I need to create that specific file? If yes where should I put it?</p>
  
  <p>Thanks in advance. </p>