db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John English <john.fore...@gmail.com>
Subject Re: Problem inserting
Date Tue, 16 Apr 2013 17:36:41 GMT
On 16/04/2013 14:46, Alejandro Rodríguez González wrote:
> Basically, I insert using this code:
>
>          public void insertInputs(Set<Input> ri) throws Exception {
> [...snip...]

Don't know if it's relevant, but have you checked what ri contains on entry? I 
had a stupid bug once along these lines...

   Set remove = oldResources;
   Set add    = newResources;
   if (add != null && oldResources != null) {
     add.removeAll(oldResources);
   }
   if (remove != null && newResources != null) {
     remove.removeAll(newResources);
   }
   ... insert the contents of "add", delete the contents of "remove" ...

which doesn't work correctly because newResources is the same set as add, so the 
first "if" has already updated it... (sometimes I hate references!)

With any luck, you'll have made a similar mistake, and it'll be an easy fix. If 
you're smarter than I was and have avoided this particular bug, then you'll need 
to post the less "interesting" parts of your code.

HTH,
-- 
John English

Mime
View raw message