Details
Description
Hello,
i have a small problem with join tables in xdoclet 2. i have a class
mapping that contains the following join table mapping (works fine
with hibernate 3.0), unnecessary tags removed so it is better to read :
<class name="Geschaeft" table="BA2_E_GESCHAEFT_VW" discriminator-value="-5" lazy="false">
<composite-id name="id" class="GeschaeftPK">
<key-property name="bank" type="java.lang.Long">
<column name="BANK_ID" scale="3" precision="0" not-null="true" sql-type="NUMBER" />
</key-property>
<key-property name="stichtag" type="java.lang.Long">
<column name="STICHTAG" scale="8" precision="0" not-null="true" sql-type="NUMBER" />
</key-property>
<key-property name="laufkennung" type="java.lang.Long">
<column name="LAUFKENNUNG_NR" scale="2" precision="0" not-null="true" sql-type="NUMBER" />
</key-property>
<key-property name="kontoNr" type="java.lang.Long">
<column name="KONTO_NR" scale="15" precision="0" not-null="true" sql-type="NUMBER" />
</key-property>
<key-property name="kontoNrSub" type="java.lang.Long">
<column name="KONTO_NR_SUB" scale="15" precision="0" not-null="true" sql-type="NUMBER" />
</key-property>
</composite-id>
<join table="BA2_R_GESCHAEFT_VW" optional="true" inverse="false"
fetch="join">
<key>
<column name="BANK_ID" scale="3" precision="0" not-null="true"
sql-type="NUMBER" />
<column name="STICHTAG" scale="8" precision="0" not-null="true"
sql-type="NUMBER" />
<column name="LAUFKENNUNG_NR" scale="2" precision="0"
not-null="true" sql-type="NUMBER" />
<column name="KONTO_NR" scale="15" precision="0" not-null="true"
sql-type="NUMBER" />
<column name="KONTO_NR_SUB" scale="15" precision="0" not-null="true"
sql-type="NUMBER" />
</key>
<property name="istKurzfristig" type="java.lang.Boolean">
<column name="IST_KURZFRISTIG" scale="1" precision="0"
not-null="false" sql-type="NUMBER" />
</property>
</join>
</class>
problem is, that
i have no idea how to tell xdoclet 2 that the property "istKurzfristig"
has to be within the join tag. xdoclet always adds the property
tag to the class tag that surrounds the join tag. Looking at the
Join.jelly file it looks like it is not possible to add properties
to the join table tag, which makes the join tag impossible to use
with xdoclet 2, or did i miss something ?
another minor problem:
incomplete documentation : @hibernate.join-key is not documented
at http://xdoclet.codehaus.org/HibernateTags
however it is required if you are using @hibernate.join (error message
tell you that the join-key is missing
[xdoclet] 15.06.2005 16:24:18 org.apache.commons.jelly.expression.jexl.JexlExp
ression evaluate
[xdoclet] WARNUNG: Caught exception evaluating: org.apache.commons.jexl.Expres
sionImpl@9ff0a8. Reason: java.lang.RuntimeException: hibernate.join-key is requi
red in AbstractGeschaeft at line 90
[xdoclet] java.lang.RuntimeException: hibernate.join-key is required in Abstra
ctGeschaeft at line 90
[xdoclet] at org.generama.Plugin.assertTrue(Plugin.java:158)
[xdoclet] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[xdoclet] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
regards,
Andreas
Hello All,
I am also facing the same issue. Please read through the description below.
##################
From: Chitragar, Vinayak
Sent: Friday, October 21, 2005 11:36 AM
To: 'xdoclet-plugins-interest@lists.sourceforge.net'
Subject: Join Tag - One2Many with table Per Concrete Class
Hello All,
I am trying to implement a construct which uses Interfaces to define 1:* association between an object and an interface which has more than one subclasses.
The class associations and hibernate mappings that works is given below. However, as XDoclet2's tag - hibernate.join - is a class level tag, I am not able to generate the hibernate mapping file using XDoclet2.
Class Associations -
1. P associated with interface X.
2. X is implemented by classes Z & Z1.
(Could not include class dia due to mail size restriction)
Please review this and let me know if there is an alternative available.
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="one2many">
<class name="P" table="PTEST">
<id name="id" column="P_ID" type="java.lang.Long">
<generator class="increment"/>
</id>
<set name="xs" table="P_XTEST">
<key column="P_ID"/>
<many-to-any meta-type="string" id-type="long">
<meta-value value="Z" class="Z"/>
<meta-value value="Z1" class="Z1"/>
<column name="X_CLASSNAME"/>
<column name="X_ID"/>
</many-to-any>
</set>
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="one2many">
<class name="Z1" table="Z1TEST">
<id name="id" column="Z1_ID" type="java.lang.Long">
<generator class="increment"/>
</id>
<join table="P_XTEST" inverse="true">
<key column="X_ID"/>
<many-to-one name="p" column="P_ID"/>
</join>
</class>
</hibernate-mapping>