db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian McCallister <mccallis...@forthillcompany.com>
Subject [bug] XDoclet M:N schema lacks FK constraints
Date Wed, 21 Jan 2004 03:20:31 GMT
Thomas D.,

Found another (small) problem with the xdoclet module. It isn't 
generating the foreign-key constraints in generated torque schema for 
M:N mappings. Take for example the following two classes and M:N 
collection:

/**
  * @ojb.class   table="GROUPS"
  *              documentation="A logical grouping of sources"
  */
public class Group
{
     /**
      * @ojb.field   primarykey="true"
      *              autoincrement="ojb"
      */
     private Integer id;

     /**
      * @ojb.collection element-class-ref="org.skife.suet.config.Source"
      *                 indirection-table="GROUP_SOURCE"
      *                 foreignkey="GROUP_ID"
      *                 remote-foreignkey="SOURCE_ID"
      *                 otm-dependent="true"
      */
     private Collection sources;
}

/**
  * @ojb.class   table="SOURCES"
  *              documentation="A source of information"
  */
public class Source
{
     /**
      * @ojb.field   primarykey="true"
      *              autoincrement="ojb"
      */
     private Integer id;

     /**
      * @ojb.field
      */
     private String uriString;

     /**
      * @ojb.field
      */
     private Timestamp added;
}

The generated torque schema is:

<database name="suet">
     <table name="GROUPS">
         <column name="id"
                 javaName="id"
                 type="INTEGER"
                 primaryKey="true"
                 required="true"
         />
     </table>
     <table name="GROUP_SOURCE">
         <column name="GROUP_ID"
                 type="INTEGER"
         />
         <column name="SOURCE_ID"
                 type="INTEGER"
         />
     </table>
     <table name="SOURCES">
         <column name="id"
                 javaName="id"
                 type="INTEGER"
                 primaryKey="true"
                 required="true"
         />
         <column name="uriString"
                 javaName="uriString"
                 type="VARCHAR"
                 size="24"
         />
         <column name="added"
                 javaName="added"
                 type="TIMESTAMP"
         />
     </table>
</database>

The GROUP_SOURCE table doesn't include the foreign key constraints.

-Brian



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


Mime
View raw message