You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Daniel Massie <ma...@dmassie.org.uk> on 2003/10/24 09:14:15 UTC

hibernate

I have goals set up to generate my hibernate mapping files, but I am 
unable to actually use these to create a database. How can I achieve 
this using maven? When I use the goal 'hibernate:schema-export' it 
builds successfully, but no schema is produced.
Any help is much appreciated.
Thanks
Daniel



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: hibernate

Posted by Michal Maczka <mm...@interia.pl>.
Daniel Massie wrote:

> I have goals set up to generate my hibernate mapping files, but I am 
> unable to actually use these to create a database. How can I achieve 
> this using maven? When I use the goal 'hibernate:schema-export' it 
> builds successfully, but no schema is produced.
> Any help is much appreciated.
> Thanks
> Daniel
>
>
maven-hibernate-plugin is a pice of sh.. (as the author I have a right 
to say so).
I haven't updated it for a long time nor I am following what's going on 
with Hibernate.
As I am not using Hinernate at the moment and I am not directly 
interested in updating this plugin (nor I am qualified for that)
- you may consider to write a small wrapper for hibernate ant tasks (in 
mave.xml).


Michal




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: hibernate

Posted by Daniel Massie <ma...@dmassie.org.uk>.
khote wrote:

>Did you set the maven.hibernate.output.file?  Are you using xdoclet?
>
>Also you have to worry about maven.hibernate.text=yes .
>
>I found that I couldn't do it either, there's something wrong with the
>hibernate plugin, I never could figure out what.
>
>It could never find my hibernate.properties file, whether I referred to it
>in the jar, absolute directory ....
>Finally I just loaded those values with a <loadproperties srcFile="">
>
>The SchemaExport.addJar also does not work (look at the Hibernate API)
>
>I'm also beginning to suspect the hibernate developers do there development
>on windows only, and port over to linux.  the SchemaExport.bat doesn't
>transfer over to a SchemaExport.sh very well, the classpathing really bites
>it.
>
>I pretty much just stole the ant/jelly code from the plugin myself and did
>it this way:
>
>  <goal name="createdb:taskdef">
>    <ant:path id="project.classpath">
>      <ant:path refid="maven.dependency.classpath"/>
>      <ant:pathelement path="${maven.build.dest}"/>
>      <ant:pathelement path="${basedir}/hibernate.properties"/>
>    </ant:path>
>    <ant:taskdef name="schemaexport"
>classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
>        classpathref="project.classpath"
>    />
>  </goal>
>
>I separated it out in case I want to write a createdb:update task later:
>
>  <goal name="createdb:export" prereqs="createdb:taskdef,jar:jar">
>    <loadproperties srcFile="${basedir}/hibernate.properties"/>
>    <ant:mkdir dir="${maven.hibernate.output.dir}"/>
>    <j:set var="hibernate.connection.datasource" value=""/>
>    <schemaexport
>      properties="${maven.build.dest}/hibernate/hibernate.properties"
>      quiet="yes"
>      text="no"
>      drop="no"
>      delimiter=";"
>      format="yes"
>      output="${maven.hibernate.output.file}">
>      <fileset dir="${maven.build.dest}">
>        <include name="**/*.hbm.xml"/>
>      </fileset>
>    </schemaexport>
>  </goal>
>
>Be sure you have some kind of postGoal for hibernate that copies the
>*.hbm.xml files into the directory where your classes have been compiled.
>
>----- Original Message ----- 
>From: "Daniel Massie" <ma...@dmassie.org.uk>
>To: <us...@maven.apache.org>
>Sent: Friday, October 24, 2003 12:14 AM
>Subject: hibernate
>
>
>  
>
>>I have goals set up to generate my hibernate mapping files, but I am
>>unable to actually use these to create a database. How can I achieve
>>this using maven? When I use the goal 'hibernate:schema-export' it
>>builds successfully, but no schema is produced.
>>Any help is much appreciated.
>>Thanks
>>Daniel
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>For additional commands, e-mail: users-help@maven.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
>  
>
thanks, that worked perfectly! :)



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: hibernate

Posted by khote <kh...@mminternet.com>.
Did you set the maven.hibernate.output.file?  Are you using xdoclet?

Also you have to worry about maven.hibernate.text=yes .

I found that I couldn't do it either, there's something wrong with the
hibernate plugin, I never could figure out what.

It could never find my hibernate.properties file, whether I referred to it
in the jar, absolute directory ....
Finally I just loaded those values with a <loadproperties srcFile="">

The SchemaExport.addJar also does not work (look at the Hibernate API)

I'm also beginning to suspect the hibernate developers do there development
on windows only, and port over to linux.  the SchemaExport.bat doesn't
transfer over to a SchemaExport.sh very well, the classpathing really bites
it.

I pretty much just stole the ant/jelly code from the plugin myself and did
it this way:

  <goal name="createdb:taskdef">
    <ant:path id="project.classpath">
      <ant:path refid="maven.dependency.classpath"/>
      <ant:pathelement path="${maven.build.dest}"/>
      <ant:pathelement path="${basedir}/hibernate.properties"/>
    </ant:path>
    <ant:taskdef name="schemaexport"
classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
        classpathref="project.classpath"
    />
  </goal>

I separated it out in case I want to write a createdb:update task later:

  <goal name="createdb:export" prereqs="createdb:taskdef,jar:jar">
    <loadproperties srcFile="${basedir}/hibernate.properties"/>
    <ant:mkdir dir="${maven.hibernate.output.dir}"/>
    <j:set var="hibernate.connection.datasource" value=""/>
    <schemaexport
      properties="${maven.build.dest}/hibernate/hibernate.properties"
      quiet="yes"
      text="no"
      drop="no"
      delimiter=";"
      format="yes"
      output="${maven.hibernate.output.file}">
      <fileset dir="${maven.build.dest}">
        <include name="**/*.hbm.xml"/>
      </fileset>
    </schemaexport>
  </goal>

Be sure you have some kind of postGoal for hibernate that copies the
*.hbm.xml files into the directory where your classes have been compiled.

----- Original Message ----- 
From: "Daniel Massie" <ma...@dmassie.org.uk>
To: <us...@maven.apache.org>
Sent: Friday, October 24, 2003 12:14 AM
Subject: hibernate


> I have goals set up to generate my hibernate mapping files, but I am
> unable to actually use these to create a database. How can I achieve
> this using maven? When I use the goal 'hibernate:schema-export' it
> builds successfully, but no schema is produced.
> Any help is much appreciated.
> Thanks
> Daniel
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org