Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Failed insert results in invalid cache state

James,
  This is a response to a previous comment you made. I had to drop this
research for projects but now i'm back on it. I wanted to follow up with
something you mentioned:

 (EclipseLink will never generate duplicates).

What type of ID generator are you referring to? And, how is the guarantee
made (in a clustered environment)? I can only think of a few ways:

1) A database table manages the sequences (select from table, auto-update to
next value)
2) EclipseLink validates the value does not already exist as an ID in the
table prior to assigning it to the object. However this doesn't guarantee
that the ID won't be assigned by another process elsewhere, inserting into
the same table.
3) In the above instance, a sequence manager manages state across all
instance of EclipseLink in use.




James Sutherland wrote:
> 
> This is pretty advanced stuff, so you may want to reconsider you reasons
> for trying to do this in the first place.  You might want to instead catch
> the exception in your app and retry the whole transaction, or avoid having
> duplicate sequence numbers in the first place (EclipseLink will never
> generate duplicates).
> 
> To get your exception handler to work, you can't create a copy, as it
> violates object identity.  You need to reset the object's pk to null.  You
> could use the descriptor to do this generically.
> 
> 
> Object value = builder.getSequenceMapping().getAttributeValue(null,
> session);
> builder.getSequenceMapping().setAttributeValueInObject(dup, value);
> 
> 

-- 
View this message in context: http://old.nabble.com/Failed-insert-results-in-invalid-cache-state-tp25384148p26443298.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top