hibernate 3.0.5
tools 3.1.0 alpha5
Code:
<hibernate-mapping package="com.carma.console.maintenance.company">
<class name="RaasCompany" schema="respraas" table="COMPANY" lazy="true" mutable="false">
<!-- Meta attributes for code generation -->
<meta attribute="scope-class">public abstract</meta>
<meta attribute="scope-field">protected</meta>
<meta attribute="implement-equals">true</meta>
<meta attribute="extends">com.carma.console.BaseHibernateObject</meta>
<meta attribute="generated-class">com.carma.console.maintenance.company.model.AbstractRaasCompany</meta>
<!-- Id -->
<id name="companyKey" column="COMPANY_KEY" type="string">
<meta attribute="use-in-tostring">true</meta>
<generator class="assigned"></generator>
</id>
<property name="name" column="COMPANY_NAME" type="string" not-null="true" length="100">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="use-in-equals">true</meta>
</property>
<many-to-one name="country" column="COUNTRY_KEY" class="com.carma.console.common.Country" not-null="true"></many-to-one>
<many-to-one name="orgCountry" column="ORG_COUNTRY_KEY" class="com.carma.console.common.Country" not-null="false"></many-to-one>
<property name="ModStamp" column="MOD_STAMP" type="date" not-null="false" length="7" />
<property name="ModFlag" column="MOD_FLAG" type="string" not-null="false" length="1" />
<property name="ModUser" column="MOD_USER" type="string" not-null="false" length="8" />
<joined-subclass name="RaasRepertoireOwner" schema="respraas" table="REPERTOIRE_OWNER" lazy="true">
<meta attribute="generated-class">com.carma.console.maintenance.company.model.AbstractRaasRepertoireOwner</meta>
<key column="REP_OWNER_KEY"></key>
<!-- many-to-one name="raasProfitCenter" column="PROFIT_CENTER_KEY" class="com.carma.console.maintenance.company.RaasProfitCenter" /-->
<property name="modStamp" column="MOD_STAMP" type="date" not-null="false" length="7" />
<property name="modFlag" column="MOD_FLAG" type="string" not-null="false" length="1" />
<property name="prodRepOwner" column="IS_PROD_REP_OWNER" type="true_false" not-null="false" length="1" />
</joined-subclass>
<joined-subclass name="RaasProfitCenter" schema="respraas" table="PROFIT_CENTER" lazy="true" >
<meta attribute="generated-class">com.carma.console.maintenance.company.model.AbstractRaasProfitCenter</meta>
<key column="PROFIT_CENTER_KEY"></key>
<!-- many-to-one name="raasParentRepertoireOwner" column="PARENT_REP_OWNER_KEY"
class="com.carma.console.maintenance.company.RaasParentRepertoireOwner" /-->
<property name="modStamp" column="MOD_STAMP" type="date" not-null="false" length="7" />
<property name="modFlag" column="MOD_FLAG" type="string" not-null="false" length="1" />
<property name="modUser" column="MOD_USER" type="string" not-null="false" length="8" />
</joined-subclass>
<joined-subclass name="RaasParentRepertoireOwner" schema="respraas" table="PARENT_REPERTOIRE_OWNER" lazy="true">
<meta attribute="generated-class">com.carma.console.maintenance.company.model.AbstractRaasParentRepertoireOwner</meta>
<key column="PARENT_REP_OWNER_KEY"></key>
<property name="modStamp" column="MOD_STAMP" type="date" not-null="false" length="7" />
<property name="modFlag" column="MOD_FLAG" type="string" not-null="false" length="1" />
<property name="modUser" column="MOD_USER" type="string" not-null="false" length="8" />
</joined-subclass>
</class>
</hibernate-mapping>
Hi,
when I use the ant task
Code:
<hibernatetool destdir="${src.dir}">
<configuration>
<fileset dir="${hbm.dir}">
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<hbm2java/>
</hibernatetool>
i always run into a problem for the above mapping file.
Code:
C:\eclipse\workspace\CarmaConsole\build.hibernate.xml:10: org.hibernate.tool.hbm2x.ExporterException: Error while processing template the second time
at org.apache.tools.ant.Task.perform(Task.java:373)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
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.tool.hbm2x.ExporterException: Error while processing template the second time
at org.hibernate.tool.hbm2x.POJOExporter.runVelocity(POJOExporter.java:97)
at org.hibernate.tool.hbm2x.POJOExporter.exportPersistentClass(POJOExporter.java:61)
at org.hibernate.tool.hbm2x.POJOExporter.start(POJOExporter.java:111)
at org.hibernate.tool.ant.GeneratorTask.execute(GeneratorTask.java:32)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:122)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
... 9 more
Caused by: org.hibernate.tool.hbm2x.ExporterException: unable to create directory: C:\eclipse\workspace\CarmaConsole\src\com\carma\console\maintenance\company\model\AbstractRaasCompanycom\carma\console\maintenance\company\model\AbstractRaasRepertoireOwnercom\carma\console\maintenance\company\model\AbstractRaasRepertoireOwnercom\carma\console\maintenance\company\model\AbstractRaasProfitCentercom\carma\console\maintenance\company\model\AbstractRaasProfitCentercom\carma\console\maintenance\company\model\AbstractRaasParentRepertoireOwnercom\carma\console\maintenance\company\model
at org.hibernate.tool.hbm2x.AbstractExporter.getDirForPackage(AbstractExporter.java:65)
at org.hibernate.tool.hbm2x.AbstractExporter.getFileForClassName(AbstractExporter.java:49)
at org.hibernate.tool.hbm2x.POJOExporter.runVelocity(POJOExporter.java:87)
... 15 more
--- Nested Exception ---
org.hibernate.tool.hbm2x.ExporterException: Error while processing template the second time
at org.hibernate.tool.hbm2x.POJOExporter.runVelocity(POJOExporter.java:97)
at org.hibernate.tool.hbm2x.POJOExporter.exportPersistentClass(POJOExporter.java:61)
at org.hibernate.tool.hbm2x.POJOExporter.start(POJOExporter.java:111)
at org.hibernate.tool.ant.GeneratorTask.execute(GeneratorTask.java:32)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:122)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
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.tool.hbm2x.ExporterException: unable to create directory: C:\eclipse\workspace\CarmaConsole\src\com\carma\console\maintenance\company\model\AbstractRaasCompanycom\carma\console\maintenance\company\model\AbstractRaasRepertoireOwnercom\carma\console\maintenance\company\model\AbstractRaasRepertoireOwnercom\carma\console\maintenance\company\model\AbstractRaasProfitCentercom\carma\console\maintenance\company\model\AbstractRaasProfitCentercom\carma\console\maintenance\company\model\AbstractRaasParentRepertoireOwnercom\carma\console\maintenance\company\model
at org.hibernate.tool.hbm2x.AbstractExporter.getDirForPackage(AbstractExporter.java:65)
at org.hibernate.tool.hbm2x.AbstractExporter.getFileForClassName(AbstractExporter.java:49)
at org.hibernate.tool.hbm2x.POJOExporter.runVelocity(POJOExporter.java:87)
... 15 more
It failes because it is trying to create the pojos into some fancy directories. I guess the tool gets confused by the multiple 'generated-class' meta attributes.
Is there any way around this? Am I doing anything wrong? Any comment is appreciated.
Thanks,
Ronald