Hibernate version: 3.2, Hibernate Tools 3.2.0.beta9a for Exclipse
Name and version of the database you are using: Oracle 9i
Hi,
I'm trying to reverse engineer from a database and add a one-to-many relationship where the foreign key is missing.
Code:
class RvsInstallation
... lots of mappings ...
Set<RvsYearly> getRvsYearlies()
class RvsYearly
... lots of mappings ...
RvsInstallation getRvsInstallation()
The primary key on RvsInstallation is RVS_INSTALLATION.INSTL_NO and I want it to join to RVS_YEARLY.INSTL_NO (which is part of the composite primary key, if that makes a difference.)
My best attempt:
Code:
<hibernate-reverse-engineering>
<type-mapping>
<sql-type jdbc-type="VARCHAR" hibernate-type="yes_no" length="1"></sql-type>
</type-mapping>
<table-filter match-name="RVS_.*" match-schema="ANDY"></table-filter>
<table name="RVS_YEARLY">
<foreign-key foreign-table="RVS_INSTALLATION">
<set property="rvsInstallation"/>
</foreign-key>
</table>
</hibernate-reverse-engineering>
produces the correct mappings in Java and the hbm.xml files but is missing the key/columns in the xml as you'd expect.
I can't figure out how to configure the column-refs, as adding:
Code:
<column-ref local-column="INSTL_NO" foreign-column="INSTL_NO"/>
Produces:
Code:
org.hibernate.tool.hbm2x.ExporterException: Error while processing template doc/tables/table.ftl
freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.tool.hbm2x.doc.DocFileManager.getRef(org.hibernate.tool.hbm2x.doc.DocFile,org.hibernate.tool.hbm2x.doc.DocFile) threw an exception when invoked on org.hibernate.tool.hbm2x.doc.DocFileManager@aa034b
freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.tool.hbm2x.doc.DocFileManager.getRef(org.hibernate.tool.hbm2x.doc.DocFile,org.hibernate.tool.hbm2x.doc.DocFile) threw an exception when invoked on org.hibernate.tool.hbm2x.doc.DocFileManager@aa034b
java.lang.IllegalArgumentException: To cannot be null.
Can anyone help?
Much appreciated,
Andy.