XDoclet 2 Plugins
  1. XDoclet 2 Plugins
  2. XDP-67

hibernate join table property cannot be configured

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: hibernate-1.0, 1.0.3
    • Fix Version/s: 1.0.4
    • Component/s: hibernate
    • Labels:
      None
    • Number of attachments :
      3

      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

      1. patch_new.txt
        4 kB
        Michael Plöd
      2. patch.txt
        5 kB
        Michael Plöd
      1. screenshot-1.jpg
        7 kB

        Activity

        Hide
        Konstantin Pribluda added a comment -

        go on...

        Show
        Konstantin Pribluda added a comment - go on...
        Hide
        Ryan Ye added a comment -

        to girish sathe
        hi, i also try to implement 'join-name' to sub tags of join. So far, i added join-name to property tag which is the most common use tag inside join, it works well.

        Show
        Ryan Ye added a comment - to girish sathe hi, i also try to implement 'join-name' to sub tags of join. So far, i added join-name to property tag which is the most common use tag inside join, it works well.
        Hide
        Ryan Ye added a comment -

        I create a patch to let join support property subtag. But I don't how to upload this patch It seems only thing i can do here is post a comment.
        Here is the test case I include in my patch, show how @hibernate.join tags works after using this patch.

        //JoinMapping.java

        package org.xdoclet.plugin.hibernate.pojo;

        /**

        • @author Ryan Ye
        • @hibernate.class table="join_parent_table"
        • @hibernate.join name="testJoin" table="join_table"
        • @hibernate.join-key column="join_key_column"
          */
          public class JoinMapping {

        /**

        • @hibernate.id generator-class="assigned"
          */
          public Integer getId() { return null; }

          /**
          * @hibernate.property column="join_property_column" join-name="testJoin"
          */
          public String getJoinProperty(){ return null; }

        }

        this java src will generate
        //JoinMapping.hbm.xml
        <?xml version="1.0" encoding="ISO-8859-1"?>
        <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

        <hibernate-mapping>
        <class table="join_parent_table" name="org.xdoclet.plugin.hibernate.pojo.JoinMapping">
        <id access="property" name="id">
        <generator class="assigned"/>
        </id>
        <join table="join_table">
        <key column="join_key_column"/>
        <property name="joinProperty" access="property" column="join_property_column"/>
        </join>
        </class>
        </hibernate-mapping>

        Show
        Ryan Ye added a comment - I create a patch to let join support property subtag. But I don't how to upload this patch It seems only thing i can do here is post a comment. Here is the test case I include in my patch, show how @hibernate.join tags works after using this patch. //JoinMapping.java package org.xdoclet.plugin.hibernate.pojo; /** @author Ryan Ye @hibernate.class table="join_parent_table" @hibernate.join name="testJoin" table="join_table" @hibernate.join-key column="join_key_column" */ public class JoinMapping { /** @hibernate.id generator-class="assigned" */ public Integer getId() { return null; } /** * @hibernate.property column="join_property_column" join-name="testJoin" */ public String getJoinProperty(){ return null; } } this java src will generate //JoinMapping.hbm.xml <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class table="join_parent_table" name="org.xdoclet.plugin.hibernate.pojo.JoinMapping"> <id access="property" name="id"> <generator class="assigned"/> </id> <join table="join_table"> <key column="join_key_column"/> <property name="joinProperty" access="property" column="join_property_column"/> </join> </class> </hibernate-mapping>
        Hide
        Konstantin Pribluda added a comment -

        You may use "manage attachments" link somewhere near the top.
        However, as this issue is already fixed, it would be better to open another
        ( and link to this one if necessary )

        so your patch can be reviewed separately.

        Show
        Konstantin Pribluda added a comment - You may use "manage attachments" link somewhere near the top. However, as this issue is already fixed, it would be better to open another ( and link to this one if necessary ) so your patch can be reviewed separately.
        Hide
        Ryan Ye added a comment -

        Thx Konstantin, I've created an new issue for this http://jira.codehaus.org/browse/XDP-213

        Show
        Ryan Ye added a comment - Thx Konstantin, I've created an new issue for this http://jira.codehaus.org/browse/XDP-213

          People

          • Assignee:
            Konstantin Pribluda
            Reporter:
            Andreas Wuest
          • Votes:
            9 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: