-->
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.  [ 11 posts ] 
Author Message
 Post subject: Custom generation
PostPosted: Sun Oct 23, 2005 4:08 pm 
Newbie

Joined: Mon Oct 17, 2005 4:09 pm
Posts: 12
I try to use custom generation with ant :

<target name="generation_custom">
<hibernatetool>
<configuration configurationfile="${generation.fichier.cfg}" >
<fileset dir="${generation.output.dir.hbm}" id="id">
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<hbmtemplate template="${generation.templates.custom.perso1}"
destdir="${generation.output.dir.custom}"
filepattern="{package-name}/{class-name}Test.java"/>
</hibernatetool>
</target>

All my variables seem to be ok but i've got this error :

BUILD FAILED
D:\travail\eclipse\workspace\Generation\generation\GenerationHibernate.xml:104:org.hibernate.tool.hbm2x.ExporterException: Error while processing template templates/custom/perso1.vm

What can i do ?
Thanks


Top
 Profile  
 
 Post subject: source of VM
PostPosted: Sun Oct 23, 2005 4:24 pm 
Newbie

Joined: Mon Oct 17, 2005 4:09 pm
Posts: 12
I find the mistake : the generator don't find my VM.
in hibernatetool target,
fileset dir=??
destdir=??
templatepath=??
etc ...
seem to search from the current folder
but
<hbmtemplate template=??
seems to search from the project root.


Top
 Profile  
 
 Post subject: What about meta model ?
PostPosted: Sun Oct 23, 2005 4:39 pm 
Newbie

Joined: Mon Oct 17, 2005 4:09 pm
Posts: 12
Where can i find the meta model. for custom templates ?
Thks


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 23, 2005 5:11 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
can you elaborate on meta model? $cfg should give the configuration object.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 24, 2005 1:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
run ant with -debug or -verbose to get more info (but be prepared to see how *bad* velocity is when it comes to exception handling)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Again and again ... one stupid question
PostPosted: Mon Oct 24, 2005 6:16 am 
Newbie

Joined: Mon Oct 17, 2005 4:09 pm
Posts: 12
I create my own vm (copy of daohome.vm).
I try to launch it but i obtained this error :

BUILD FAILED
C:\projets\workspace\Generation\generation\GenerationHibernate.xml:166: org.hibernate.tool.hbm2x.ExporterException:
MethodInvocationException while processing template generation/templates/custom/idao.vm.
Invocation of method 'getJavaTypeName' in class org.hibernate.tool.hbm2x.Cfg2JavaTool threw exception class java.lang.NullPointerException : null

Total time: 4 seconds

Have you an idea ?
THKX


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 24, 2005 6:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes - getJavaTypeName is called with something bad, like a null.

/max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: custom generation
PostPosted: Mon Oct 24, 2005 7:48 am 
Newbie

Joined: Mon Oct 17, 2005 4:09 pm
Posts: 12
> yes - getJavaTypeName is called with something bad, like a null.
> max

exactly , it's the same code that in "daohome.vm" :
$c2j.getJavaTypeName($clazz.identifierProperty)

i don't understand why this line work in "daohome.vm"
but not in my own template ... ???


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 24, 2005 7:59 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
can it be that you class does not have an identifierproperty ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Custom generation
PostPosted: Mon Oct 24, 2005 8:36 am 
Newbie

Joined: Mon Oct 17, 2005 4:09 pm
Posts: 12
In fact, i want to test the custom generation.
1 - i generated some hbm from hibernate ant tools.
<target name="generation_hbm" description="generation des fichiers hbm">
<hibernatetool>
<jdbcconfiguration revengfile="${generation.reveng.cfg}"
configurationfile="${generation.fichier.cfg}"/>
<hbm2hbmxml destdir="${generation.output.persistance.dir.hbm}" />
</hibernatetool>
</target>

2 - i launched the generation of dao of Hibernate Tools :
<target name="generation_dao" description="generation des dao">
<hibernatetool>
<configuration configurationfile="${generation.fichier.cfg}" >
<fileset dir="${generation.output.persistance.dir.hbm}" id="id">
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<hbm2dao destdir="${generation.output.persistance.dir.dao}" templatepath="${generation.templates.dir}"/>
</hibernatetool>
</target>

3 - With an exact copy of "daohome.vm", i execute the task below :
<target name="generation_interface_dao" description="generation des interfaces des dao">
<hibernatetool>
<configuration configurationfile="${generation.fichier.cfg}" >
<fileset dir="${generation.output.persistance.dir.hbm}" id="id">
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<hbmtemplate
destdir="${generation.output.persistance.dir.idao}"
template="${generation.templates.idao}"
filepattern="${generation.output.persistance.package.idao}/I{class-name}.java"/>
</hibernatetool>
</target>
------------------------------------------------------------------------
The result is :
- i have ann error other $c2j.getJavaTypeName($clazz.identifierProperty)
- if i delete theses lines, i get as one file for an hbm plus an other file is the hbm have a complex primary key (like hbm2java).


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 24, 2005 8:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
so we might have a bug with dao generation when you have composite keys. put it in jira.

_________________
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.  [ 11 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.