You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Thomas Paradies <pa...@transit-online.de> on 2004/09/20 18:13:15 UTC

OJB XDoclet generating torque table schema

While using the xdoclet ojb module (v1.0.0) I'm running into the same problem
as described in an older message from 2003 - see 
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgNo=7009.

Following the thread I found an response - but no solution... In resumption 
of this thread I append a short example with two classes and the resulting 
schemas. As you can see there are no foreign key in torque schema. BTW, i 
got no error messages from XDoclet. Maybe, I'm wrong, sorry for inconvenience.
 
Thanks in advance,
Thomas

-------
CLASSES
-------
/**
 * @ojb.class table="A"
 */
public class A {
    /**
     * @ojb.field column="ID" primarykey="true" autoincrement="ojb"      
     */
    private int id;
    /**
     * @ojb.collection element-class-ref="B" foreignkey="aId"
     */
    private Collection bs;
}

/**
 * @ojb.class table="B"
 */
public class B {
    /**
     * ojb.field column="ID" primarykey="true" autoincrement="ojb"
     */
    private int id;
    /**
     * @ojb.field name="aId" column="AID"
     */
    private int aId;
}
---------------
REPOSITORY_USER
---------------
<class-descriptor
    class="A"
    table="A"
>
    <field-descriptor
        name="id"
        column="ID"
        jdbc-type="INTEGER"
        primarykey="true"
        autoincrement="true"
    >
    </field-descriptor>
    </field-descriptor>
    <collection-descriptor
        name="bs"
        element-class-ref="B"
    >
        <inverse-foreignkey field-ref="aId"/>
    </collection-descriptor>
</class-descriptor>
<class-descriptor
    class="B"
    table="B"
>
    <field-descriptor
        name="aId"
        column="AID"
        jdbc-type="INTEGER"
    >
    </field-descriptor>
</class-descriptor>
-------------
TORQUE-SCHEMA
-------------
<database name="test">
    <table name="A">
        <column name="ID"
                javaName="id"
                type="INTEGER"
                primaryKey="true"
                required="true"
        />
    </table>
    <table name="B">
        <column name="ID"
                javaName="id"
                type="INTEGER"
                primaryKey="true"
                required="true"
        />
        <column name="AID"
                javaName="aId"
                type="INTEGER"
        />
    </table>
</database>

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OJB XDoclet generating torque table schema

Posted by Thomas Dudziak <to...@first.fhg.de>.
Thomas Paradies wrote:

> While using the xdoclet ojb module (v1.0.0) I'm running into the same problem
> as described in an older message from 2003 - see 
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgNo=7009.
> 
> Following the thread I found an response - but no solution... In resumption 
> of this thread I append a short example with two classes and the resulting 
> schemas. As you can see there are no foreign key in torque schema. BTW, i 
> got no error messages from XDoclet. Maybe, I'm wrong, sorry for inconvenience.

Currently the generation of foreignkeys for collections is not supported 
because of the involved difficulties (e.g. indirection tables, 
inheritance, mapping to the same table). See also this (short) thread:

http://nagoya.apache.org/eyebrowse/BrowseList?listName=ojb-user@db.apache.org&by=thread&from=827465

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org