-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: hibernatetool ant task does not pass-in properties
PostPosted: Mon Oct 26, 2009 7:43 am 
Newbie

Joined: Thu Oct 15, 2009 8:04 am
Posts: 6
Hello everyone,

I'm trying to export DDL schema generation code for a JPA project using the hibernate tool ant task. The relevant part of the ant build file is:

Code:
   <path id="jpatoolslib">
      <path location="../3rdParty/Hibernate/Tool/org.hibernate.eclipse.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/bsh-core-2.0b4.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/tools/bsh-2.0b1.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/tools/freemarker.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/tools/hibernate-tools.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/tools/jtidy-r8-20060801.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/antlr-2.7.6.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/asm-attrs.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/asm.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/c3p0-0.9.1.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/cglib-2.1.3.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/commons-collections-2.1.1.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/commons-logging-1.0.4.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/concurrent-1.3.2.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/connector.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/dom4j-1.6.1.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/ehcache-1.2.3.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/hibernate3.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/jaas.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/javassist.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/jboss-cache.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/jboss-common.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/jboss-jmx.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/jboss-system.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/jdbc2_0-stdext.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/jgroups-2.2.8.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/jta.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/log4j-1.2.15.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/oscache-2.1.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/proxool-0.8.3.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/hibernate/swarmcache-1.0rc2.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/annotations/ejb3-persistence.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/annotations/hibernate-annotations.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/annotations/hibernate-commons-annotations.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/annotations/hibernate-entitymanager.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/annotations/hibernate-search.jar" />
      <path location="../3rdParty/Hibernate/Tool/lib/annotations/lucene-core-2.2.0.jar" />
      
      <path location="./lib/POJODeploymentDeps/ojdbc14.jar" />
      <path location="./lib/POJODeploymentDeps/mysql-connector-java-5.1.5-bin.jar" />
      <path location="./lib/POJODeploymentDeps/jtds-1.2.2.jar" />
   </path>

   
   
   <taskdef   name="hibernatetool"
            classname="org.hibernate.tool.ant.HibernateToolTask"
            classpathref="jpatoolslib"
   />
   
   
   <target name="create-schema">
      <hibernatetool destdir="./database/ddl/SQLServer">
         <classpath>
            <!-- <path location="./dist/POJO/lib/${pojo}.jar" />-->
            <path location="./dist/POJO/lib" />
         </classpath>
      
         <jpaconfiguration />

         <property   key="hibernate.dialect"         value="org.hibernate.dialect.SQLServerDialect"/>
      
         <!-- persistenceunit="IdentityManagerPOJO" -->

         <!-- list exporters here -->
         <hbm2ddl   export="false"
                  update="false"
                  drop="false"
                  create="false"
                  outputfilename="sqlserver.ddl"
                  delimiter=";"
                  format="false"
                  haltonerror="true">
            
            <property   key="hibernate.dialect"      value="org.hibernate.dialect.SQLServerDialect"/>
         </hbm2ddl>
      </hibernatetool>
   </target>      


When I attempts to create the schema, I receive the following exception:

Code:
create-schema:
[hibernatetool] Executing Hibernate Tool with a JPA Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
[hibernatetool] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
[hibernatetool] log4j:WARN Please initialize the log4j system properly.
[hibernatetool] An exception occurred while running exporter #2:hbm2ddl (Generates database schema)
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect.

BUILD FAILED
C:\data\svndata\ABIS7\IM20\IMInterface\build\ddlBuild.xml:66: org.hibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect.
   at org.hibernate.tool.ant.HibernateToolTask.reportException(HibernateToolTask.java:226)
   at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:189)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
   at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
   at org.apache.tools.ant.Task.perform(Task.java:348)
   at org.apache.tools.ant.Target.execute(Target.java:357)
   at org.apache.tools.ant.Target.performTasks(Target.java:385)
   at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
   at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
   at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
   at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
   at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
   at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
Caused by: org.hibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect.
   at org.hibernate.dialect.Dialect.instantiateDialect(Dialect.java:233)
   at org.hibernate.dialect.Dialect.getDialect(Dialect.java:211)
   at org.hibernate.dialect.Dialect.getDialect(Dialect.java:226)
   at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:86)
   at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:61)
   at org.hibernate.tool.hbm2x.Hbm2DDLExporter.doStart(Hbm2DDLExporter.java:153)
   at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
   at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
   at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)
   ... 15 more
--- Nested Exception ---
org.hibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect.
   at org.hibernate.dialect.Dialect.instantiateDialect(Dialect.java:233)
   at org.hibernate.dialect.Dialect.getDialect(Dialect.java:211)
   at org.hibernate.dialect.Dialect.getDialect(Dialect.java:226)
   at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:86)
   at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:61)
   at org.hibernate.tool.hbm2x.Hbm2DDLExporter.doStart(Hbm2DDLExporter.java:153)
   at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
   at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
   at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
   at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
   at org.apache.tools.ant.Task.perform(Task.java:348)
   at org.apache.tools.ant.Target.execute(Target.java:357)
   at org.apache.tools.ant.Target.performTasks(Target.java:385)
   at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
   at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
   at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
   at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
   at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
   at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)

Total time: 1 second

It seems that the propertyhibernate.dialect is not properly propagated although this is documented. I have used two places, within the hbm2ddl and within the hibernatetool but it does not work.

I'm I doing something wrong?

Thanks in advance,
-Rainer


Top
 Profile  
 
 Post subject: Re: hibernatetool ant task does not pass-in properties
PostPosted: Mon Oct 26, 2009 10:42 am 
Newbie

Joined: Thu Oct 15, 2009 8:04 am
Posts: 6
Yes, this works indeed. So my problermis are solved.

Still I think the other approach should have worked according to what is explcitly documented.

Thanks,
-Rainer


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.