Hi.
I have the following problem with a 1-n mapping:
These two classes mentioned below (we use Castor Doclet to generate
the mapping files, the generated mapping.xml is also attached!)
are mapped 1-n, akey is foreign key in table B.
When reading via oql ("SELECT u from A u") the Arraylist in EVERY A
contains EVERY B found in the database regardless of its foreign key.
What could be wrong here?
The value classes:
------------------
/**
* @table A
* @xml a
*/
class A
{
/**
* @primary-key
* @required
* @not-null
* @sql-type numeric
* @sql-size 10
*/
public int akey;
/**
* @field-type B
* @required
* @many-key contactID
*/
public Arraylist bs;
}
/**
* @table B
* @xml b
*/
class B
{
/**
* @primary-key
* @required
* @not-null
* @sql-type numeric
* @sql-size 10
*/
public int bkey;
/**
* @field-type A
* @sql-name akey
* @required
*/
public int akey;
/**
* @sql-type varchar
* @sql-size 250
*/
public string something;
}
------------------------------------------------
The generated mapping.xml:
--------------------------
<mapping>
<class name="A" identity="akey">
<map-to table="A" xml="a"/>
<field name="akey" type="integer" direct="true" required="true">
<sql type="numeric" name="akey"/>
<bind-xml name="akey"/>
</field>
<field name="bs" collection="arraylist" direct="true" type="B"
required="true">
<sql many-key="akey"/>
<bind-xml name="bs"/>
</field>
</class>
<class name="B" identity="bkey">
<map-to table="B" xml="b"/>
<field name="bkey" type="integer" direct="true" required="true">
<sql type="numeric" name="bkey"/>
<bind-xml name="bkey"/>
</field>
<field name="akey" type="A" direct="true" required="true">
<sql name="akey"/>
<bind-xml name="akey"/>
</field>
<field name="somethin" type="string" direct="true">
<sql type="varchar" name="something"/>
<bind-xml name="something"/>
</field>
</class>
</mapping>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev