Ok, I'll try CVS tomorrow. I did try to search mail archives, but couldn't find anything on this.
Trevor
-----Original Message-----
From: Thomas Yip
To: [EMAIL PROTECTED]
Sent: 31/10/01 5:29 PM
Subject: Re: [castor-dev] 1 to many loads incorrectly
I think you're reporting a known issue that has been fixed for two
months.
Please use the cvs version. (more info can be found in the mail achieve)
Thomas
-----Original Message-----
>From: Trevor Cook [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, October 31, 2001 1:51 PM
>To: [EMAIL PROTECTED]
>Subject: Re: [castor-dev] 1 to many loads incorrectly
>
>Regarding my earlier message, I've narrowed the problem down, so
hopefully this helps to find a fix. For the purposes of reproducing the
bug, modify the examples "jdo.Test" class so that the xml marshalling
near the end which looks like:
>
> marshaller.marshal( db.load( Product.class, new Integer( 4 ) )
);
> computerOql = db.getOQLQuery( "SELECT c FROM myapp.Computer c"
);
> results = computerOql.execute();
> while( results.hasMore() )
> marshaller.marshal( results.next() );
>is replaced with:
>
> computerOql = db.getOQLQuery( "SELECT c FROM myapp.Product c"
);
> results = computerOql.execute();
> while( results.hasMore() )
> marshaller.marshal(results.next());
>All this does is change it so it's marshalling each object from a list
of objects, rather than 2 seperately loaded objects. Anyway, the
problem boils down to the cache. If you add the line:
>
> <cache-type type="none" />
>to each of the classes in the mapping file, it blows up the whole show.
When it does the marshalling, it will display the first product (4)
properly, but the second product (computer 6) will have ALL 4 detail
items (the 2 it owns, and the 2 from product). Also, when it finishes
the above code and reaches db.commit(), it will delete all 4 details
from the database. As you can see, I have done no major changes to this
test file. The only real "change" I can see is using no cache. Does
Castor not function without the cache on?
>
>HELP!!! desperately needed.
>Trevor D. Cook
>
>
>
>
> -----Original Message-----
>From: Trevor Cook [mailto:[EMAIL PROTECTED]]
>Sent: October 31, 2001 2:25 PM
>To: [EMAIL PROTECTED]
>Subject: [castor-dev] 1 to many loads incorrectly
>I have a group of "Entry" objects which each has a collection of
"permissions". Partial mapping below.
> <class
name="com.intrinity.instore.castor.security.persistent.PersistentAclEntr
y" identity="id" key-generator="SEQUENCE">
> <description>Acl Entry</description>
> <cache-type type="none" />
> <map-to table="aclentries" xml="acl_entry" />
> <field name="id" type="integer">
> <sql name="id" type="integer" />
> <xml name="id" node="attribute" />
> </field>
> <field name="principalId" type="integer">
> <sql name="userid" dirty="ignore" />
> <xml name="user_id" node="element" />
> </field>
> <field name="permissions"
type="com.intrinity.instore.castor.security.persistent.PersistentAclEntr
yPermission" collection="vector" required="true">
> <sql many-key="aclentryid"/>
> <xml name="permission" node="element" />
> </field>
> </class>
> <class
name="com.intrinity.instore.castor.security.persistent.PersistentAclEntr
yPermission" identity="id" key-generator="SEQUENCE"
depends="com.intrinity.instore.castor.security.persistent.PersistentAclE
ntry">
> <description>Acl Permission</description>
> <cache-type type="none" />
> <map-to table="aclpermissions" xml="acl_permission" />
> <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="integer" dirty="ignore" />
> <xml name="name" node="element" />
> </field>
> <field name="aclEntry"
type="com.intrinity.instore.castor.security.persistent.PersistentAclEntr
y">
> <sql name="aclentryid" />
> <xml name="aclentry" node="element" />
> </field>
> </class>
>
>When I try to load a list of these objects using the query:
>"SELECT a FROM " + PersistentAclEntry.class.getName() + " a"
>It messes up BADLY. It loads ALL the permissions into ALL of the
entries. For example, if we were supposed to have the following:
>Entry 1 has Perm A B C
>Entry 2 has Perm D E F
>Entry 3 has Perm G
>instead we have:
>Entry 1 has Perm A B C D E F G
>Entry 2 has Perm A B C D E F G
>Entry 3 has Perm A B C D E F G
>I repeated this test on another of my class structures (Customer has
Addresses) and the same thing occured. What I've found is that loading
a SPECIFIC object by identity works properly (gets appropriate child
objects), but loading LIST of all "master" objects causes all child
objects to be added to every master. I tracked this into the
SqlEngineClass around line XXX but got lost (not familiar with code).
Any suggestions to fix this would be greatly appreciated, since this
kills my program.
>Details: Using Postgres 7.1 with castor's postgres driver, and Castor
v0.9.3.
>Thanks,
>Trevor D. Cook
>
