Hi,
have you tried CVS version?
Oleg
On Monday 27 August 2001 09:41, Patrick Tonidandel wrote:
> -----Urspr�ngliche Nachricht-----
> Von: Patrick Tonidandel [mailto:[EMAIL PROTECTED]]
> Gesendet: Friday, August 24, 2001 5:19 PM
> An: [EMAIL PROTECTED]
> Betreff: Re: [castor-dev] Why does Castor remove dependent objects after
> query?
>
>
> I have the same problem.
>
> My mapping file is the same of the Castor Example :
>
> <!-- Mapping for Product -->
> <class name="castortest3.Product"
> identity="id">
> <description>Product definition</description>
> <map-to table="prod" xml="product" />
> <field name="id" type="integer">
> <sql name="id" type="integer" />
> <xml name="id" node="attribute"/>
> </field>
> <field name="name" type="string">
> <sql name="name" type="char" />
> <xml name="name" node="element" />
> </field>
> <field name="price" type="integer">
> <sql name="price" type="integer" />
> <xml name="price" node="element" />
> </field>
>
> <!-- Product has reference to ProductGroup,
> many products may reference same group -->
> <field name="group" type="castortest3.ProductGroup">
> <sql name="group_id" />
> <xml name="group" node="element" />
> </field>
>
> <!-- Product has reference to ProductDetail
> many details per product -->
> <field name="details" type="castortest3.ProductDetail" required="true"
> collection="vector">
> <sql many-key="prod_id"/>
> <xml name="detail" node="element" />
> </field>
> </class>
>
> <!-- Mapping for Product Detail -->
> <class name="castortest3.ProductDetail" identity="id"
> depends="castortest3.Product" >
> <description>Product detail</description>
> <map-to table="prod_detail" xml="detail" />
> <field name="id" type="integer">
> <sql name="id" type="integer"/>
> <xml node="attribute"/>
> </field>
> <field name="product" type="castortest3.Product" >
> <sql name="prod_id" />
> <xml name="product" node="element" />
> </field>
> <field name="name" type="string">
> <sql name="name" type="char"/>
> <xml node="text" />
> </field>
> </class>
> </mapping>
>
> After invoking the following query :
>
> String q = "SELECT s FROM ";
> q = q+"s in castortest3.Product ";
> query = db.getOQLQuery(q);
>
> while (results.hasMore()) {
> count++;
> pr = (Product) results.next();
> System.out.println("pr.getId() : "+pr.getId());
> System.out.println("pr.getName() : "+pr.getName());
> System.out.println("pr.getGroup() : "+pr.getGroup());
> System.out.println("pr.getDetails() : "+pr.getDetails());
> }
>
> the dependent ProductDetails are going deleted.
>
> [patrick] Castor: Removing castortest3.ProductDetail (2)
> [patrick] Castor: Removing castortest3.ProductDetail (3)
> [patrick] Castor: Removing castortest3.ProductDetail (1)
> [patrick] Castor: Removing castortest3.ProductDetail (4)
> [patrick] Castor: Removing castortest3.ProductDetail (5)
>
> Another problem is that the upper while-statement returns the the dependent
> details in wrong way. That means, the following products return details
> that are not related to them, but related to prior products. It seems that
> castor keeps the old ProductDetail in memory, an thats wrong.
>
> Any help is very appreciated.
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev