This is a very special question, I hope that somebody here already worked in a similar project setup.

I am working with Netbeans and started a maven web project based upon the maven HS 4.x tutorial on http://www.hibernatespatial.org/tutorial-hs4.html

This compiles fine using maven.

Next I want to use the maven hibernate3 plugin from MOJO (http://mojo.codehaus.org/hibernate3-maven-plugin/index.html), so I can create SQL Scripts and the database schema out of my java entitiy classes. So the workflow should be

  1. code java entitiy classes with spatial (postgis) fields
  2. compile
  3. create DDL out of entity classes
  4. create/update database schema with DDL
  5. run app

The problem is, when I run

mvn hibernate3:hbm2ddl

The plugin does not search for hibernate spatial in the remote repo on www.hibernatespatial.org like the compile plugin does, but searches for it in the central repo. Due to the fact, that the hibernate-spatial.jar does not exist there, DDL creation fails. This is what the maven output looks like:

[ERROR] Failed to execute goal org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm2ddl ... Plugin org.codehaus.mojo:hibernate3-maven-plugin:2.2 or one of its dependencies could not be resolved: Could not find artifact org.hibernate:hibernate-spatial:jar:4.0-M1 in central (http://repo.maven.apache.org/maven2) -> [Help 1]
Caused by: ... Could not find artifact org.hibernate:hibernate-spatial:jar:4.0-M1 in central (http://repo.maven.apache.org/maven2)
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

As I already mentioned, maven compile goal works and resolves hibernate-spatial correctly.

Is there an alternative way to create database schema out of java entity classes without the maven hibernate plugin?


Ok, problem was a wrong hibernate version in the first place, but also wrong use of hibernate3 plugin with hibernate4, and some missing hibernate4 libraries. Got it working now without the maven plugin, based on the correct use of JPA EntityManager and auto schema generation. Works like a charm now.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.