-
Notifications
You must be signed in to change notification settings - Fork 934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for caching fetched relations with Criteria #2090
Add support for caching fetched relations with Criteria #2090
Conversation
@@ -55,7 +55,6 @@ public void InitializeDerivedSelectClause(FromClause fromClause) | |||
|
|||
ASTAppender appender = new ASTAppender(ASTFactory, this); // Get ready to start adding nodes. | |||
int size = fromElements.Count; | |||
List<IType> sqlResultTypeList = new List<IType>(size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small unrelated clean up
This comment has been minimized.
This comment has been minimized.
Nope. I'm wrong. Transformers are applied in both cases before caching. All we need is hql query with fetches and additional data in output and transformer that modifies number of objects in results. So something like this fails in hql on master too: var list = session.CreateQuery("select o.Customer.CompanyName, o from Order o join fetch o.Customer")
.SetCacheable(true)
.SetResultTransformer(new RootEntityResultTransformer())
.List<object>(); |
So the issue: The fix: put in cache untransformed results for queries that recognized as "queries with fetched relations" |
Found another cache quirk. Entities returned in hql/linq projections (like Though this issue is unrelated to changes here or in #1952. As this query doesn't have fetches and processed by old logic. |
e454d82
to
384c145
Compare
This comment has been minimized.
This comment has been minimized.
100b5fe
to
103ac5e
Compare
103ac5e
to
1a63a40
Compare
1a63a40
to
fe69cac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have rebased for fixing conflicts.
public class QueryOverCacheableTests : CriteriaNorthwindReadonlyTestCase | ||
{ | ||
//Just for discoverability | ||
private class CriteriaCacheableTest{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not get what is its purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make it appear in search when user enters Criteria
trying to find some Criteria related tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can-it be just a comment, not a dummy class?
Or do we need really need it anyway? It is there just because query-over is an added layer to criteria and so test it by the way, isn't-it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can-it be just a comment, not a dummy class?
When I'm not sure which test fixture I need I often try to find fixture class I need by some keywords. So comment is less discoverable than dummy class. Well if you really dislike it - you can drop it.
It is there just because query-over is an added layer to criteria and so test it by the way, isn't-it?
Yes.
fe69cac
to
f512086
Compare
And why bug? IMHO it's a new feature |
Hm... Ok. I didn't pay attention how it was classified for Linq/hql. But if re-qualifying means only changing labels - let's re-qualify. IMO those PRs should be stated in release in New Features list. |
Follow up to #1952
As for Criteria it's much simpler to collect entities that are already present in
ResultTypes
(and so in cache) I've reversed original implementation - and instead of additional entities to cache provide entities that already cached. And additional entities (fetched entities and collections) are calculated automatically.