I don't know if I understand you correctly but assuming you want to get current and last revision of the 10 "Notes" last modified...
1. Find what Note entities that are changed most recently. Looking at the mapping I guess, in your case, you can simply use the main tables for this (DateStamp property) 2. When having the id:s from 1., run something like... auditReader.CreateQuery() .ForRevisionsOf<Note>() .Add(AuditEntity.Id().Eq(theId)) .AddOrder(AuditEntity.RevisionNumber().Desc()) .SetMaxResult(2); ________________________________ Från: nhusers@googlegroups.com [nhusers@googlegroups.com] för David Hilbmann [davidahilbm...@gmail.com] Skickat: den 6 augusti 2013 22:14 Till: nhusers@googlegroups.com Ämne: [nhusers] How do I get the last ten revisions or unique entities and determine changes against current entity? Hey everyone, In my audit table I have a bunch of revisions. I want to query the audit table for the last ten unique, revised entities (by id), then compare those entities to the current entities in my non-audit table. If Envers doesn't have a utility to compare and report differences then I can write one -- that's not a big deal. What is a big deal is getting the right entities from the audit table. I can either get all or none and I don't want to do some post-processing of the query to filter the results further. :( Any ideas? I'm using NHibernate Envers 1.6.0 and this is my mapping for the table... <?xml version="1.0" encoding="utf-8"?> <hibernate-mapping assembly="Project.Core" namespace="Project.Core.Model" xmlns="urn:nhibernate-mapping-2.2"> <class name="Note" table="note" lazy="true" > <id name="Id"> <column name="id" sql-type="Guid" not-null="true" /> <generator class="assigned" /> </id> <version name="Version" type="BinaryBlob" unsaved-value="null" generated="always"/> <many-to-one lazy="false" name="Tor"> <column name="tor_id" sql-type="Guid" not-null="false" /> </many-to-one> <property name="NoteTitle" > <column name="note_title" sql-type="varchar" not-null="false" length="100"/> </property> <property name="NoteText"> <column name="note_text" sql-type="varchar" not-null="false" length="5000"/> </property> <property name="DateStamp"> <column name="date_stamp" sql-type="datetime" not-null="false" /> </property> <many-to-one lazy="false" name="EnteredBy"> <column name="entered_by" sql-type="Guid" not-null="false" /> </many-to-one> <property name="IsDeleted"> <column name="is_deleted" sql-type="bit" not-null="false" /> </property> </class> </hibernate-mapping> -- 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 nhusers+unsubscr...@googlegroups.com. To post to this group, send email to nhusers@googlegroups.com. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/groups/opt_out. -- 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 nhusers+unsubscr...@googlegroups.com. To post to this group, send email to nhusers@googlegroups.com. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/groups/opt_out.