I'm thinking out loud here... If Envers would offer an API like your proposal, I would guess it wouldn't take long before it ain't enough... Probably someone needs q.Detail.DetailInfo to be included as well -> you need to be able to define a big tree of entities. I will think about this...
Anyhow, even today you should probably be able to do what you want if you get the revisions for your quote entity followed by a query (queries ?) to get appropriate revisions for quotedetails. Have a look at https://bitbucket.org/RogerKratz/nhibernate.envers/src/9ecad0c2289a/Src/NHibernate.Envers.Tests/Integration/Query/RevisionConstraintQueryTest.cs. Then you will have all affected revisions for Quote and QuoteDetails. I don't say this is optimal though. A first good step for this situation would be to port audit strategy (http://216.121.112.228/browse/NHE-1) which gives the user the possibility not only persist an audit date but also an end date. That way queries like this would be easier. I hope I will find the time for this port "soon" (day, week or month - don't know ;)). /Roger -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Chris Richards Sent: den 15 mars 2011 10:51 To: nhusers Subject: [nhusers] Re: Envers and parent / child relationship I was thinking of how best to allow an end user to view the history of changes, and I think it would be best to show or access this via the parent entity. As suggested in the link Roger gave, a better solution would be to be able to get all the revisions for a parent entity and its child entities in a single query. So you could have something like: auditReader.GetRevisions<Quote>(quoteId, q => q.Details); which would return the revisions for a Quote and all the revisions for the associated QuoteDetails. Would it be possible to implement this using an AuditQuery? Chris On Mar 14, 6:44 pm, Roger Kratz <[email protected]> wrote: > Chris, > > Without knowing why you want this, maybe this > threadhttp://community.jboss.org/message/567412(the thread is true also for > NHibernate Envers) can give you some understanding about this. > > /Roger > > ________________________________ > Från: [email protected] [[email protected]] för Fabio > Maulo [[email protected]] > Skickat: den 14 mars 2011 18:54 > Till: [email protected] > Ämne: Re: [nhusers] Envers and parent / child relationship > > Envers is not about "single entity version", it is about "whole domain state > version". > The REV in Envers is like the revision in SVN. > A revision is about the state of the whole domain under audit. > > On Mon, Mar 14, 2011 at 1:08 PM, Chris Richards > <[email protected]<mailto:[email protected]>> > wrote: > Using Envers, if I have a parent / child relationship is it possible > to up the version of the parent entity if a property on a child entity > is modified? For example, if I had a Quote parent entity with a > collection of QuoteDetail child entities, when a property on a > QuoteDetail is modified then both QuoteDetail and the parent Quote > have their revision number updated. > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to > [email protected]<mailto:[email protected]>. > To unsubscribe from this group, send email to > [email protected]<mailto:nhusers%2Bunsubscribe@googlegro > ups.com>. > For more options, visit this group > athttp://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 > athttp://groups.google.com/group/nhusers?hl=en. -- 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. -- 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.
