Most probably caused by this bug in NH Core https://nhibernate.jira.com/browse/NH-2907
This bug occurs when having a dynamic model with key-many-to-one mapping and the related entity has equals and/or gethashcode overridden. Internally Envers uses this mapping (you cannot change this). The bug causes the related entity to be eagerly loaded -> this is what happens to you. To see if this is the bug causing your issue, remove the equals and gethashcode implementation of your custom revision entity. I strongly suggest _not_ doing that in production though. I suggest you vote for this NH Core bug. /Roger PS: You can use AuditEntity.RelatedId(“ParentObject”) in your query instead – nothing to do with your issue though. From: [email protected] [mailto:[email protected]] On Behalf Of Johannes Aberidis Sent: den 15 oktober 2014 15:49 To: [email protected] Subject: [nhusers] Nhibernate-Envers: Audit-Query generates subsequent queries for the revision info Hi, I'm in a C#-project which uses NHibernate (4.0) with Envers (2.0) and Fluent. The problem I'm facing is that executing an Audit-Query generates subsequent queries for the revision info. Example: var query = AuditReader.CreateQuery() .ForEntitiesAtRevision<Entities.Attribute>(someNumber) .Add(AuditEntity.Property("ParentObject.Id").Eq(someId)) .Results(); If this query returns, for example, 100 entities having different revision numbers, Envers generates 100 queries in separate roundtrips to read the revisioninfo entity. (custom RevisionInfo-Entity, set via .SetRevisionEntity<>). Therefore performance decreases dramatically with the number of entities returned. I would be glad if someone could give me a hint how to solve this. Regards -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To post to this group, send email to [email protected]<mailto:[email protected]>. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
