Hi Martin,

is there a way to check if user uD was successfully associated to M?
Have add and remove of associations to be done manually?

What I saw in the meantime while debugging: 
Collection result = getCollectionByQuery(fkQuery, cds);
(in QueryReferenceBroker.java, method retrieveCollection(...), line 566)
returns an array with the number of users stored in the database. Also the 
resultArray in line 574 is filled correctly.

Regards,
Frank

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

Hiller, Frank RD-AS2 wrote:
> 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.

Since you are using the low-level PB API you have to think about "helping" OJB 
understand your object graphs. If you do like this:

1. load machine M referencing 3 users: M{uA uB uC} 2. create a new user uD and 
associate with M 3. remove user uD's association with M 4. store M (with 
auto-delete and RemovalAwareCollection with set of {u})

You could have a problem in how exactly you perform step 2 and/or 3.

In step 1 OJB's cache is set up with (I'm using @x to denote a Java 
object-reference pointer):
[EMAIL PROTECTED]@2{uA uB uC}

You must perform step 2 so that uD is added to the exact vector [EMAIL 
PROTECTED], since this one keeps track internally of removed objects to be 
deleted on store. (In accordance you must also perform step 3 so that you 
actually remove it from the
[EMAIL PROTECTED] and not just break the link from uD->M).

Could you show us a bit of your code? (No need to re-post class descriptors, I 
have them on file.) It's to set up a testcase trying to reproduce your results 
if you show some of the implementation details.

Regards,
  Martin

P.S. I might be the wrong person trying to explain this, since it's not really 
as complicated as it might look like in my text. :)

---------------------------------------------------------------------
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