Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>how can I configure hbm2cfgxml so that hibernate.cfg.xml looks like below (...)</p> </blockquote> <p>I have a project that is using <code>hbm2cfgxml</code> and the <code>&lt;mapping resource="..."/&gt;</code> entries do reflect the packagename in the path to the <code>hbm.xml</code>. So there is clearly something wrong on your side. Here are a few remarks:</p> <ul> <li>I would bind <code>hbm2cfgxml</code> on the <code>generate-resources</code> phase, you're not generating sources</li> <li>I wouldn't generate the file in <code>src/main/resources</code> but in <code>target/classses</code> (why do you put generated stuff in the source tree, you want a <code>clean</code> to clean it).</li> <li>There is a typo, it's <code>configurationfile</code>, not <code>configurationFile</code> but...</li> <li>Why the hell do you have a <code>&lt;configurationfile&gt;</code> in the configuration of <code>hbm2cfgxml</code>? You want to generate it here... I would remove it.</li> </ul> <p><strong>Update:</strong> You should put the informations required to connect to the database in <code>src/main/resources/database.properties</code> (that's the default value of the <a href="http://mojo.codehaus.org/maven-hibernate3/hibernate3-maven-plugin/componentproperties.html" rel="noreferrer"><code>propertyfile</code></a> property), not in <code>src/main/resources/hibernate.cfg.xml</code> (remove that file). Below a sample <code>database.properties</code>:</p> <pre><code>hibernate.connection.driver_class=org.apache.derby.jdbc.ClientDriver hibernate.connection.url=jdbc:derby://localhost:1527//home/pascal/Projects/derbyDBs/EMPLDB hibernate.connection.username=APP hibernate.connection.password=APP hibernate.dialect=org.hibernate.dialect.DerbyDialect </code></pre> <p>And as I said, remove the <code>src/main/resources/hibernate.cfg.xml</code> file, you want to generate it.</p> <blockquote> <p>is there a way to tell maven to copy resources to the target folder before executing hbm2java? (...)</p> </blockquote> <p>The <a href="http://mojo.codehaus.org/maven-hibernate3/hibernate3-maven-plugin/hbm2java-mojo.html" rel="noreferrer"><code>hbm2java</code></a> goal <em>Invokes the execution of the lifecycle phase process-resources prior to executing itself</em> (from the documentation). So that's the default behavior and occurs with <code>hibernate3:hbm2java</code> or <code>generate-sources</code> <strong>if</strong> <code>hbm2java</code> is bound to it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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