Re: way too many SELECTs?
Re: way too many SELECTs?
- Subject: Re: way too many SELECTs?
- From: Ken Anderson <email@hidden>
- Date: Sat, 14 Feb 2015 10:04:49 -0500
This is certainly odd behavior - something else must be going on.
In your example (a) will always happen - EOF will fault in relationships before adding objects to them. But, once that relationship is there, it should stay in that EO until some kind of invalidation happens.
Any chance you could post all the code?
Ken
On Feb 14, 2015, at 8:24 AM, OC <email@hidden> wrote:
> Hello there,
>
> as Alice said, it gets couriouser and couriouser. I am now logging SQL, and -- at least to me -- it seems my application is SELECTing way too often.
>
> The code is still related to the price offers of my previous posts; this time though I am using the default EC and I am not setting fetchTimestamp.
>
> I am creating new objects in an entity DBPriceOffer and adding them to 1:N relationship of an entity DBUser -- all of them to the same user.
>
> Now, what I would (naïvely?) assume is that
> (a) the first time this happens, the user's price offers _might be_ fetched (not necessarily, but possibly)
> (b) nevertheless, when they _are_ once fetched into the EC, they won't be re-fetched anytime soon, for EC caches them and EOF does not make unnecessary roundtrips to the DB.
>
> They get re-fetched though -- each sweet time again, with the same EC, no fetchTimestamp. My app never refaults nor refreshes anything. There's about 95 % free heap, so there should be no flushing of soft caches, if WO uses them at all. My current code looks like this:
>
> ===
> DBPriceOffer o=new DBPriceOffer()
> createdBy.editingContext.insertObject(o)
> ...
> println "WEIRD 27 newo: $o, creator: $createdBy // EC:${o.editingContext()} (FTS:${(System.currentTimeMillis()-o.editingContext().fetchTimestamp())/1000} s)"
> o.addObjectToBothSidesOfRelationshipWithKey(createdBy,'user')
> //createdBy.addObjectToBothSidesOfRelationshipWithKey(o,'priceOffers') // tried this too, works precisely same way
> println "WEIRD 31
> ===
>
> and adding price offers through this code _always_ re-fetches the user's relationship into which they are being added:
>
> ===
> WEIRD 27 newo: <DBPriceOffer@1247321477 PK:null N /EC:176991315>, creator: <DBUser@2069151341 PK:1000008 Name:'cl' /EC:176991315> // EC:er.extensions.eof.ERXEC@a8cac53 (FTS:3996.348 s)
> 14:09:16.912 DEBUG evaluateExpression: <com.webobjects.jdbcadaptor.FrontbasePlugIn$FrontbaseExpression: "SELECT ... FROM "T_PRICE_OFFER" t0 WHERE t0."C_CREATOR_ID" = 1000008" withBindings: >
> 14:09:16.922 DEBUG 179 row(s) processed
> WEIRD 31
> ...
> WEIRD 27 newo: <DBPriceOffer@81493054 PK:null N /EC:176991315>, creator: <DBUser@2069151341 PK:1000008 Name:'cl' /EC:176991315> // EC:er.extensions.eof.ERXEC@a8cac53 (FTS:4001.53 s)
> 14:09:22.090 DEBUG evaluateExpression: <com.webobjects.jdbcadaptor.FrontbasePlugIn$FrontbaseExpression: "SELECT ... FROM "T_PRICE_OFFER" t0 WHERE t0."C_CREATOR_ID" = 1000008" withBindings: >
> 14:09:22.099 DEBUG 180 row(s) processed
> WEIRD 31
> ...
> WEIRD 27 newo: <DBPriceOffer@1879220176 PK:null N /EC:176991315>, creator: <DBUser@2069151341 PK:1000008 Name:'cl /EC:176991315> // EC:er.extensions.eof.ERXEC@a8cac53 (FTS:4006.075 s)
> 14:09:26.635 DEBUG evaluateExpression: <com.webobjects.jdbcadaptor.FrontbasePlugIn$FrontbaseExpression: "SELECT ... FROM "T_PRICE_OFFER" t0 WHERE t0."C_CREATOR_ID" = 1000008" withBindings: >
> 14:09:26.643 DEBUG 181 row(s) processed
> WEIRD 31
> ...
> ===
>
> and so forth: whenever I add a new price offer into the same user's 1:N relationship, the price offers of that user get re-fetched again.
>
> I'm flabbergasted. Is this the normal WebObjects (or, rather, EOF) behaviour? Am I missing something of importance?
>
> Thanks,
> 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
_______________________________________________
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