Thanks, Fabio. That's an interesting blog post, I will check out the
tolerant cache.

Could you explain a little why you don't think it is worth trying to
update a query in the cache?

I am thinking of the following tow situations:

A) Current Situation:

1) do expensive query on table FOO, (NH mapping class FOO_ENTITY) and
put query and entities returned in L2 cache
2) create new FOO_ENTITY
3) FOO_ENTITY is now cached in the entity cache
4) run query again: must hit RDBMS again

OR


B) With Query Updates:

1) do expensive query on table FOO, (NH mapping class FOO_ENTITY) and
put query and entities returned in L2 cache
2) create new FOO_ENTITY
3) FOO_ENTITY is now cached in the entity cache
4) do not invalidate the query, but instead run in-memory query on
FOO_ENTITY, and possibly add to cached query ids
5) no extra hit to RDBMS

My NH knowledge is very limited, so I am probably missing something
big here.

Cheers,
Jorge



> you will not gain something querying first the cacje and then the RDBMS
> where needed.
> If you can accept "eventual consistency" queries avoiding the cache
> invalidation at each insert/update/delete what you are looking for 
> is:http://fabiomaulo.blogspot.com/2009/04/tuning-nhibernate-tolerant-que...
>
>



>
> On Wed, Nov 17, 2010 at 12:45 PM, Throckmorton <[email protected]> wrote:
> > Thanks, Stefan. Will see what I can cook up.
> > But I am guessing that once you have the AST, it would be fairly
> > easy to generate the LINQ query. And, since Mono has implemented
> > LINQ, there may be some code I can scavenge there.
>
> > If this were possible, then one could really put the L2 query cache
> > on drugs: not only cache the query results, but also the LINQ
> > equivalent
> > of the HQL, so that the LINQ query could be *run on the entity cache*.
>
> > Which would mean that after an insert, the query could be updated
> > rather than
> > invalidated, as it is currently done.
>
> > On Nov 17, 3:52 am, Stefan Wenig <[email protected]> wrote:
> > > I was just going off on a tangent. AFAIK, what you describe cannot be
> > > done, unless somebody comes and builds it. Wouldn't hold my breath
> > > though, HQL was not built for in-memory execution.
>
> > > I'd rather go look for a way to serialize in-memory LINQ queries.
>
> > >http://stackoverflow.com/questions/4036489/what-is-the-easiest-way-to...
>
> > > Also, Silverlight RIA toolkit has code that does that. For remote
> > > invocation, not storage, but hey...
> > > problems:
> > > - in RIA toolkit, serialization (client) and deserialization (server)
> > > use similar, but different types.
> > > - if you compile an IQueryable expression, it will compile to the
> > > IQueryable and Queryable extension methods. you'd need to replace that
> > > with IEnumerable and Enumerable extension methods so that they
> > > actually do the work instead of just creating expression trees again.
>
> > > Other stuff might be available. Tell us if you find a way!
>
> > > HTH,
> > > Stefan
>
> > > On 16 Nov., 21:12, Throckmorton <[email protected]> wrote:
>
> > > > Wait a second, I'm confused.
>
> > > > a) I start with an HQL query, which is just a string.
> > > > b) NH is designed to apply this HQL to a database, by first converting
> > > > to ANTLR
> > > > c) I want to apply the HQL to an in-memory collection instead
> > > > d) so, I could use the LINQ equivalent, if it can be generated from
> > > > the HQL
> > > > e) since LINQ and HQL get converted to ANTLR expression, I would need
>
> > > > HQL ==> ANTLR ===> LINQ
>
> > > > f) this may be currently impossible
>
> > > > On Nov 16, 11:12 am, Stefan Wenig <[email protected]> wrote:
>
> > > > > You're right, I skipped a step. I once asked steve strong whether he
> > > > > could emit the HQL as a string for diagnostics. He said: easily.
> > (much
> > > > > easier than serializing and deserializing LINQ in any case...)
>
> > > > > but anyway, I digress.
>
> > > > > On 15 Nov., 11:55, Stefan Wenig <[email protected]> wrote:
>
> > > > > > BTW, internally, LINQ is converted to HQL. There might be a way to
> > > > > > extract, save and execute this HQL.
>
> > > > > > On 13 Nov., 20:06, Jorge <[email protected]> wrote:
>
> > > > > > > yeah, I guess I will store a linq query along with the HQL.
> > > > > > > Problem is, LINQ cannot be serialized to disk, while HQL can.
> > > > > > > So, if HQL could be converted to LINQ, then this would be the
> > nicest
> > > > > > > solution.
>
> > > > > > > On Nov 13, 8:09 am, Jason Meckley <[email protected]>
> > wrote:
>
> > > > > > > > that would be linq then :)
>
> > > > > > > > On Nov 12, 8:22 pm, Jorge <[email protected]> wrote:
>
> > > > > > > > > Hello!
> > > > > > > > > Is it possible to take an HQL query and apply it to a
> > collection of
> > > > > > > > > entities in memory?
> > > > > > > > > Something similar to LINQ?
>
> > > > > > > > > Thanks!
> > > > > > > > > Jorge- Zitierten Text ausblenden -
>
> > > > > > > - Zitierten Text anzeigen -- Zitierten Text ausblenden -
>
> > > > > > - Zitierten Text anzeigen -- Zitierten Text ausblenden -
>
> > > > - Zitierten Text anzeigen -
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nhusers" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<nhusers%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
>
> --
> Fabio Maulo

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to