• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Never save objects which don't pass a test (was: searching for a weird deletion)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Never save objects which don't pass a test (was: searching for a weird deletion)


  • Subject: Re: Never save objects which don't pass a test (was: searching for a weird deletion)
  • From: Chuck Hill <email@hidden>
  • Date: Sat, 21 Feb 2015 20:11:13 +0000
  • Thread-topic: Never save objects which don't pass a test (was: searching for a weird deletion)



On 2015-02-21, 11:17 AM, "OC" wrote:

Chuck,

On 21. 2. 2015, at 20:09, Chuck Hill <email@hidden> wrote:
I think it is a fair expectation that EOF may not properly support optimistic

pessimistic, I guess?

Cough.  Yes.



locking.  I am not even sure how to set it up properly.  There are some methods on EOEditingContext and EODatabaseContext, and one the EODatabaseContext Delegate.

Thanks!

One closely related question -- I suppose there is no way to explicitly set up the isolation level and locking discipline for a particular transaction (differently from the default of the JDBC connexion URL)? Or is there one?

You could set up a second EOF stack and set the JDBC url isolation level and locking discipline to what you want and use that stack for these transactions.

Chuck


Thanks again and all the best,
OC

On 2015-02-21, 3:42 AM, "OC" wrote:
Anyway, back to the original question --
On 20. 2. 2015, at 18:27, OC <email@hidden> wrote:
Actually _this_ should not be weird, this should be quite a normal code; the only requirement is that check-and-save, i.e., conceptually,
===
if (TEST(eo.someRelationship().someAttribute(),newAttributeValue)) {
   def new=EOUtilities.createAndInsertInstance(eo.editingContext(),'SomeRelationshipTarget')
   new.someAttribute=newAttributeValue
   eo.editingContext().saveChanges()
}
===
so that I can be absolutely sure that nobody stores an attribute value which -- at the moment of COMMITTing the appropriate INSERT -- would not pass the TEST
I don’t think you can make a rock-solid guarantee from the app code level.
Can't I? That's bad.
-- I have succeeded to consult with my client, and the option of „allowing to save any bid, determine whether it was valid or not in future“ is out.
On the other hand, he again suggests pessimistic locking: „why don't we simply lock the auction row when user reads the data to determine whether his bid is valid, and unlock when he saves the valid bid or when he determines the bid is not valid“?
I can see only one slight drawback -- unnecessary locks in case the bid validation fails -- but that should be a negligible problem, most bid attempts are valid (and _if_ they become invalid, then since other bid was entered shortly before, which would lead to optimistic exception anyway).
Far as I understand though based on your
===
On 24. 1. 2015, at 0:12, Chuck Hill <email@hidden> wrote:
I doubt that lockObject() code in EOF has been run in… maybe forever.  It is highly possible that it is causing EOF to get confused and resulting in the errors below.  Get rid of the lockObject() calls and see if the problem below goes away.
===
I guess the proper answer is „Well we can't use pessimistic row locking at all, since EOF does not support it reliably, and that's that.“
Is that right?
Thanks again,
OC


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >searching for a weird deletion (From: OC <email@hidden>)
 >Re: searching for a weird deletion (From: Ramsey Gurley <email@hidden>)
 >Re: searching for a weird deletion (From: OC <email@hidden>)
 >Re: searching for a weird deletion (From: Chuck Hill <email@hidden>)
 >Never save objects which don't pass a test (was: searching for a weird deletion) (From: OC <email@hidden>)
 >Re: Never save objects which don't pass a test (was: searching for a weird deletion) (From: OC <email@hidden>)
 >Re: Never save objects which don't pass a test (was: searching for a weird deletion) (From: Chuck Hill <email@hidden>)
 >Re: Never save objects which don't pass a test (was: searching for a weird deletion) (From: OC <email@hidden>)

  • Prev by Date: Re: Never save objects which don't pass a test (was: searching for a weird deletion)
  • Next by Date: Pre-fetching
  • Previous by thread: Re: Never save objects which don't pass a test (was: searching for a weird deletion)
  • Next by thread: Re: searching for a weird deletion
  • Index(es):
    • Date
    • Thread