Note that there are some explanatory texts on larger screens.

plurals
  1. POwhat the heck is a JPA configuration?
    text
    copied!<p>I'm going nuts trying to get a simple <a href="http://www.jboss.org/files/envers/docs/index.html" rel="nofollow noreferrer">Envers</a> example to work. I'm stuck on the <code>org.hibernate.tool.ant.EnversHibernateToolTask</code> &mdash; it looks like I finally got all the jar files I needed, but now I get the error message </p> <pre><code>[hibernatetool] Persistence unit not found: 'ConsolePU'. BUILD FAILED C:\deka\proj\java\test-database\build.xml:61: Persistence unit not found: 'ConsolePU'. </code></pre> <p>As far as I can tell, persistence units are associated with JPA <code>persistence.xml</code> files. But I'm not using a persistence.xml file; I'm using hibernate.cfg.xml &mdash; but the envers example has a <code>&lt;jpaconfiguration&gt;</code> in the ant task:</p> <pre><code>&lt;hibernatetool destdir="."&gt; &lt;classpath&gt; &lt;fileset dir="src/"&gt; &lt;include name="**/*.hbm.xml"/&gt; &lt;/fileset&gt; &lt;path location="${buildDir}" /&gt; &lt;/classpath&gt; &lt;jpaconfiguration persistenceunit="ConsolePU" /&gt; &lt;hbm2ddl drop="false" create="true" export="false" outputfilename="versioning-ddl.sql" delimiter=";" format="true"/&gt; &lt;/hibernatetool&gt; </code></pre> <p>is there something that I can replace it with to get it to work with the hibernate.cfg.xml file? There seems to be ZERO documentation on how to get all this stuff to work properly. </p> <p><strong>edit:</strong> OK, so the main problem was I didn't understand the hibernatetool options and what was appropriate for my app. I did find the <a href="https://www.redhatrenewals.com/docs/en-US/JBoss_Developer_Studio/en/hibernatetools/html/ant.html" rel="nofollow noreferrer">Hibernate ant docs</a>, fortunately. Thanks. Now I have a new problem: I'm using annotations, but I also have set up a hibernate.cfg.xml for the properties settings. The <code>hibernatetool</code> task only lets me run either <code>&lt;configuration /&gt;</code> or <code>&lt;annotationconfiguration /&gt;</code> not both, and even <code>&lt;configuration /&gt;</code> won't work since I already have annotations doing things. How can I migrate my property settings from the hibernate.cfg.xml file to my annotations?</p> <p><strong>edit:</strong> Duh, I didn't realize you just do:</p> <pre><code>&lt;annotationconfiguration configurationfile="...filename..." /&gt; </code></pre> <p>per the <a href="https://www.redhatrenewals.com/docs/en-US/JBoss_Developer_Studio/en/hibernatetools/html/ant.html#d0e3018" rel="nofollow noreferrer">hibernatetool task docs.</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload