Hi Martin,

using p6spy was a good idea.
I tryed the way of using only pb.store(obj) with the following result.
I had a machine with three employees logged on. Now I let a fourth person log 
on to the machine on my test system.
The person was added to the EMPLOYEES table, I can see the insert statement in 
spy.log.

Now I logged off the person. I see the update of the MACHINE table and I see 
update statements for the three remaining persons. But I do not see a delete 
statement for the logged off person.

Now I logged off another person. I see the update statements for the two 
remaining persons. But I do not again see a delete statement for the logged off 
person.

Because the list of updated persons becomes smaller, it makes me guess the 
persons are removed from cache. But these entries were not removed from the 
database table.

Best regards,
Frank

PS.:

Class/collection descriptors look like this:
 
   <class-descriptor
      class="com.aaa.bbb.ccc.ddd.Machine"
      table="MACHINE"
   >

  // some field descriptors....
 
   <collection-descriptor
      name="employees"
      element-class-ref="com.aaa.bbb.ccc.ddd.Employee"
      auto-retrieve="true"
      auto-update="true"
      auto-delete="true"
  orderby="personalid"
  sort="ASC"
    >
  <inverse-foreignkey field-ref="deviceID" />
     </collection-descriptor>
   </class-descriptor>

 
   <class-descriptor
      class="com.aaa.bbb.ccc.ddd.Employee"
      table="EMPLOYEE"
   >
 
      <field-descriptor
         name="familyName"
         column="FAMILYNAME"
         jdbc-type="VARCHAR"
         primarykey="false"
         autoincrement="false"
      />
 
     <field-descriptor
         name="firstName"
         column="FIRSTNAME"
         jdbc-type="VARCHAR"
         primarykey="false"
         autoincrement="false"
      />
     
     <field-descriptor
         name="personalID"
         column="PERSONALID"
         jdbc-type="VARCHAR"
         primarykey="true"
         autoincrement="false"
      />
     
     <field-descriptor
         name="roles"
         column="ROLES"
         jdbc-type="VARCHAR"
         primarykey="false"
         autoincrement="false"
      />
 
     <field-descriptor
         name="deviceID"
         column="DEVICEID"
         jdbc-type="VARCHAR"
         primarykey="true"
         autoincrement="false"
      />
 
   </class-descriptor>


-----Ursprüngliche Nachricht-----
Von: Martin Kalén [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 16. März 2005 21:48
An: OJB Users List
Betreff: Re: How to delete single objects in a referenced collection?

Hiller, Frank RD-AS2 wrote:
> In the first table I have the machines and in the second one the 
> currently logged on persons. In the EMPLOYEES table I'm using a PK of 
> two columns (PERSONALID / MACHINEID). I'm not using ID. When a person 
> logs off, it is not deleted from EMPLOYEES table when using .store(obj).
> The object contains the reduced collection of employees.

In the database, is the column "EMPLOYEE.PERSONALID" a foreign key or reference 
to another table? If you a dropping people from this table the sequence of 
things in the transaction could be important.

If the removal aware collection is trying to delete EMPLOYEE when personalId is 
either 0/null or references a deleted tuple, I guess you will run into problems.


There is also no object-level cache consistency in the PB API, so it could 
simply be that you are reading the object back from cache when testing?

Use P6Spy to check what SQL statements are beeing sent to the database.

Regards,
  Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to