aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate Reverse & codegen Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate Reverse & codegen" Watch "Hibernate Reverse & codegen" New topic
Author

Hibernate Reverse & codegen

Jari Timonen
Ranch Hand

Joined: Jan 16, 2004
Posts: 232
Hello,

Hibernate3, Hibernate-Tools Beta 4, SDK 1.4.2

I'm generating code from database. I'm overriding existing templates to generate my custom methods. Pojo code is generated properly, but daohome.vm-code gives error:

Error
------
D:\cvs\blah\www\bin\build.xml:199: org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException while processing t
emplate templates/dao/daohome.vm. Invocation of method 'getJavaTypeName' in class org.hibernate.tool.hbm2x.Cfg2JavaTool threw exc
eption class java.lang.NullPointerException : null



build.xml
---------
<taskdef
name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpath="${lib.dir}/Hibernate/hibernate-tools.jar;
${lib.dir}/Hibernate/hibernate3.jar;
${lib.dir}/Hibernate/velocity-1.4.jar;
${lib.dir}/Hibernate/commons-logging-1.0.4.jar;
${lib.dir}/Hibernate/jtidy-r8-21122004.jar;
${lib.dir}/Hibernate/dom4j-1.6.1.jar;
${lib.dir}/ojdbc14-9205.jar;
${lib.dir}/Hibernate/ehcache-1.1.jar;
${lib.dir}/Hibernate/cglib-2.1.3.jar;
${lib.dir}/Hibernate/asm.jar;
${lib.dir}/Hibernate/commons-collections-2.1.1.jar;
${lib.dir}/Hibernate/velocity-tools-generic-1.1.jar"/>
<hibernatetool destdir="${build.classes.dir}">
<jdbcconfiguration configurationfile="../configuration/Hibernate/hibernate.cfg.xml"
revengfile="hibernate.reveng.xml"/>
<property key="jdk5" value="false"/>
<property key="ejb3" value="false"/>
<hbm2hbmxml destdir="../configuration/Hibernate"/>

<!--hbm2dao destdir="${src.dir}/com/blah/persistence/dataaccess/gen"/-->

<hbmtemplate destdir="${src.dir}/com/blah/persistence/dataaccess/gen" templateprefix="dao/" template="templates/dao/daohome.vm" filepattern="{package-name}/{class-name}Home.java"/>
<hbmtemplate destdir="${src.dir}/com/blah/persistence/dto" templateprefix="pojo/" template="templates/pojo/Pojo.vm" filepattern="{package-name}/{class-name}.java"/>
<hbmtemplate destdir="${src.dir}/com/blah/persistence/datainterface" templateprefix="pojo/" template="templates/pojo/PojoInterface.vm" filepattern="{package-name}/{class-name}I.java"/>

</hibernatetool>

---------

Any ideas???


SCJP 5.0, SCJD URLyBird 1.3.3, OCMJEA 5 (SCEA) Factory Homes
jason none
Greenhorn

Joined: Apr 24, 2006
Posts: 2
ever find a solution to this? thanks!!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Hibernate Reverse & codegen