-->
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.  [ 5 posts ] 
Author Message
 Post subject: templatepath for hibernatetools tasks
PostPosted: Thu Jul 21, 2005 2:44 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
Hibernate version: 3.0.5
Hibernate tools version: current cvs from yesterday

Just want to tell you guys and max how the templatepaths in
the hibernatetools task work.

Here is the code from ant:

Code:
<hibernatetool destdir="${project.dir}/exp">
  <jdbcconfiguration    
    configurationfile="${project.dir}/tstdata/ant/erk/hibernate.cfg.xml"
    revengfile="${project.dir}/tstdata/ant/erk/hibernate.reveng.xml"/>
  <cfg2hbm/>
  <hbm2java templatespath="${project.dir}/tstdata/ant/erk"/>
</hibernatetool>


It will do this:
1. open a connection to my database
2. get a list of all tables
3. generate hbm files using the reveng file
4. generate java class using the velocity file pojo/javaclass.vm
this has to be below the templatepath here: ${project.dir}/tstdata/ant/erk

If you are content with defaults you do not need templatepath and reveng files. The default pojo/javaclass.vm is in hibernatetools.jar

thats really a fine tool!

@max: can you add some lines to doc? there is no hint about templatepath expecting a velocity file in pojo/javaclass.vm.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 21, 2005 1:48 pm 
Newbie

Joined: Fri Apr 16, 2004 11:48 am
Posts: 18
Hi,

I am not clear if this tool is just reading from the database or if its also trying to issue some create comands.

I had this error:

Caused by: com.sybase.jdbc2.jdbc.SybSQLException: The 'CREATE TABLE' command is
not allowed within a multi-statement transaction in the 'tempdb' database.

Which makes me think that its issuing some create commands. Same for
<hbm2ddl outputFileName="temp.txt"/>

Any idea?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 22, 2005 4:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
thank you steck.

If you have time it would be great if you simply just added a patch for the docs describing this to the jira - thank you!

And milasx, what you are seeing is sybase which for reasons unknown to me apparently want to execute "something" when we ask for columns on a table. Look for the exception on google and you should be able to find how to workaround it (something like "enable ddl in transaction"...

but rest assured that only schemaexport with export="true" is actually executing create/alter statements - the rest is pure reading

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: how does this work
PostPosted: Mon Dec 08, 2008 5:56 pm 
Newbie

Joined: Mon Dec 08, 2008 5:51 pm
Posts: 8
How is this executed as an ant task?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2008 7:47 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you put the <hjbernatetool> into your build.xml and run ant.

see details about it in the docs.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.