Hey Chuck et al,
This is a follow-up question for you. I'm doing things like the code shown below in quite a few places. I'm assuming the ERXEC's are locked automagically as normal during the RR loop, but are
you saying I also need to explicitly lock the EODatabaseContext in this case? Do I need to manually lock the EC too? When do these things need to be manually locked? Do I need to manually lock the EC when I'm getting a ref. to the EOModel, EOAttributes,
etc...?
EODatabaseContext
db = EOUtilities.databaseContextForModelNamed(editingContext(), "myModel");
EOSQLExpressionFactory sqlFactory = db.adaptorContext().adaptor().expressionFactory();
EOSQLExpression exp = sqlFactory.createExpression(al);
exp.setUseBindVariables(true);
exp.setStatement(sql);
//set the values
exp.addBindVariableDictionary(
exp.bindVariableDictionaryForAttribute(al.attributeNamed(Al.E_KEY), user().e().id()));
exp.addBindVariableDictionary(
exp.bindVariableDictionaryForAttribute(al.attributeNamed(Al.U_KEY), user()));
exp.addBindVariableDictionary(
exp.bindVariableDictionaryForAttribute(al.attributeNamed(Al.AL_KEY), AlEnum.GSTONE));
exp.addBindVariableDictionary(
exp.bindVariableDictionaryForAttribute(al.attributeNamed(Al.AL_KEY), AlEnum.GSTRATEGY));
//execute the query
NSArray<NSDictionary> rows = ERXEOAccessUtilities.rawRowsForSQLExpression(editingContext(),
"myModel", exp);
return ((BigDecimal) rows.get(0).valueForKey("NUMBER")).intValue();
Thanks.
-Mike
On Mar 21, 2013, at 1:42 PM, Michael Gargano wrote:
I've checked this in our code several times, there is another app where we do stuff like that, but not in this one.
Thanks.
-Mike
-----Original Message-----
From: Chuck Hill [mailto:email@hidden]
Sent: Thursday, March 21, 2013 11:07 AM
To: Michael Gargano
Cc: vladimir gadyatskiy; WebObjects Development; Mark Cassidy
Subject: Re: EOF - statement has been closed?
Another possibility is that something in your code (or Wonder, unlikely to be in WO itself) is accessing the database context or below without proper locking and using and closing this statement behind EOF's back. It looks less like a race condition and more
like an improperly shared resource.
Chuck
On 2013-03-21, at 7:47 AM, Michael Gargano wrote:
Hi Vladimir,
Mark and I work together. We have not found the solution to this problem. We modified the postgres jdbc driver to provide some additional logging, and whatever slight delay that has added seems to have lessened the frequency
of the problem. We're not sure where it is happening, but I'm convinced it has to be a race condition in wonder or EOF at this point (unless there's something wrong with the postgres jdbc driver which I find hard to believe since so many people are using
it). I've included Mark on this email as well. Maybe we can find a solution.
Thanks.
-Mike
From:
webobjects-dev-bounces+mgargano=email@hidden [mailto:webobjects-dev-bounces+mgargano=email@hidden] On Behalf Of vladimir gadyatskiy
Sent: Wednesday, March 20, 2013 3:25 PM
To: WebObjects Development
Subject: RE: EOF - statement has been closed?
Hello, all
Sorry, I do not know how to ask Mark Cassidy directly, he'd asked about connection lost problems here: http://lists.apple.com/archives/webobjects-dev/2013/Jan/msg00429.html
Mark, did you find a solution? Seems we have the same problems with Postgres 9.2...
Thanks for any help.
Best regards,
Vladimir Gadyatskiy
_______________________________________________
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
--
Chuck Hill
Executive Managing Partner, VP Development and Technical Services
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/gvc/practical_webobjects
Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada's Fastest-Growing Companies by PROFIT Magazine!
_______________________________________________
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
|