Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, I fixed my problem by forcing maven to put the <code>hbm.xml</code> files into the <em>/target/classes/package/name</em> folder, so at the end my pom looks like this:</p> <pre><code>&lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;hibernate3-maven-plugin&lt;/artifactId&gt; &lt;version&gt;2.2&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;hbm2cfgxml&lt;/id&gt; &lt;phase&gt;generate-resources&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;hbm2cfgxml&lt;/goal&gt; &lt;/goals&gt; &lt;inherited&gt;false&lt;/inherited&gt; &lt;configuration&gt; &lt;components&gt; &lt;component&gt; &lt;name&gt;hbm2cfgxml&lt;/name&gt; &lt;implementation&gt;jdbcconfiguration&lt;/implementation&gt; &lt;/component&gt; &lt;/components&gt; &lt;componentProperties&gt; &lt;packagename&gt;package.name&lt;/packagename&gt; &lt;/componentProperties&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;execution&gt; &lt;id&gt;hbm2hbmxml&lt;/id&gt; &lt;phase&gt;generate-resources&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;hbm2hbmxml&lt;/goal&gt; &lt;/goals&gt; &lt;inherited&gt;false&lt;/inherited&gt; &lt;configuration&gt; &lt;components&gt; &lt;component&gt; &lt;name&gt;hbm2hbmxml&lt;/name&gt; &lt;outputDirectory&gt;target/classes&lt;/outputDirectory&gt; &lt;/component&gt; &lt;/components&gt; &lt;componentProperties&gt; &lt;packagename&gt;package.name&lt;/packagename&gt; &lt;/componentProperties&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;execution&gt; &lt;id&gt;hbm2java&lt;/id&gt; &lt;phase&gt;generate-sources&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;hbm2java&lt;/goal&gt; &lt;/goals&gt; &lt;inherited&gt;false&lt;/inherited&gt; &lt;configuration&gt; &lt;components&gt; &lt;component&gt; &lt;name&gt;hbm2java&lt;/name&gt; &lt;implementation&gt;configuration&lt;/implementation&gt; &lt;/component&gt; &lt;/components&gt; &lt;componentProperties&gt; &lt;packagename&gt;package.name&lt;/packagename&gt; &lt;configurationfile&gt;target/hibernate3/generated-mappings/hibernate.cfg.xml&lt;/configurationfile&gt; &lt;/componentProperties&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;execution&gt; &lt;id&gt;hbm2dao&lt;/id&gt; &lt;phase&gt;generate-sources&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;hbm2dao&lt;/goal&gt; &lt;/goals&gt; &lt;inherited&gt;false&lt;/inherited&gt; &lt;configuration&gt; &lt;components&gt; &lt;component&gt; &lt;name&gt;hbm2dao&lt;/name&gt; &lt;implementation&gt;configuration&lt;/implementation&gt; &lt;/component&gt; &lt;/components&gt; &lt;componentProperties&gt; &lt;packagename&gt;package.name&lt;/packagename&gt; &lt;configurationfile&gt;target/hibernate3/generated-mappings/hibernate.cfg.xml&lt;/configurationfile&gt; &lt;/componentProperties&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;postgresql&lt;/groupId&gt; &lt;artifactId&gt;postgresql&lt;/artifactId&gt; &lt;version&gt;8.4-701.jdbc3&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; </code></pre> <p>And it works ok. As fas as I could see in other posts, in some early build phases those <code>hbm.xml</code> files should be copied from <em>target/hibernate3/generated-mappings</em> (where they are generated by default) to <em>target/classes/package/name</em> (where hibernate-tools looks for them), but in my case they aren't (which indicates I'm doing something wrong). So if there is anyone out there knowing what it might be I'm doing wrong, please tell me. Otherwise It'll have to suffice.</p> <p>There is one thing that isn't working: the package names aren't used in the generated POJOs and DAOs: but I created another thread for this <a href="https://stackoverflow.com/questions/2848567/how-to-configure-hbm2java-and-hbm2dao-to-add-packagename-to-generated-classes">here</a>.</p> <p><strong>Update:</strong> ok, now I finally got it. The problem with missing package names was in the <code>hbm2hbmxml</code> goal's configuration. I missed the <em>componentProperties</em> with <em>packagename</em> there, so the generated <code>hbm.xml</code> missed the fully classified class names. I updated the above pom, now it works fine. The issue regarding explicit copying the <code>hbm.xml</code> files to the <em>target/classes</em> folder is still the case, though.</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. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    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