Well, I'm using the ConventionModelMapper so no real configuration to speak 
of.  I can still post it if you would like, but I was hoping I had just 
made some common mistake.

I'm under a pretty tight deadline so I just added the required properties 
directly to my revision class and removed the inheritance from 
DefaultRevisionEntity.  The schema is now what I expected.  I really think 
it might be my fault so I'll see if I can reproduce the issue with a 
minimal project.  If so, I'll see if I can find a good spot for another 
test case.

-Patrick


On Sunday, April 1, 2012 9:53:44 AM UTC-5, Roger wrote:
>
> What's you mapping for EnversRevisionEntity?
>
> ________________________________
> Från: [email protected] [[email protected]] för Patrick
> Skickat: den 31 mars 2012 01:42
> Till: [email protected]
> Ämne: Re: [nhusers] Envers with a PrimitiveType
>
> I'll try and explain it a little better.  At the end of section 4 of the 
> documentation, there is this sentence: "Having an "empty" revision entity - 
> that is, with no additional properties except the two mandatory ones - is
> also an easy way to change the names of the table and of the properties in 
> the revisions table automatically generated by Envers."  To me, that says 
> the default fields would be renamed, not just added to.  This is the 
> default schema for the REVINFO table without a custom entity:
>
>     create table Audit.REVINFO (
>        REV INT IDENTITY NOT NULL,
>        REVTSTMP DateTime null,
>        primary key (REV)
>     )
>
> If I use the EnversRevisionEntity I posted earlier (which inherits from 
> DefaultEnversEntity which already has the annotations you described), I 
> would expect this schema:
>
>     create table Audit.REVINFO (
>         Id INT IDENTITY not null,
>        UserFk INT null,
>        RevisionDate DATETIME null,
>        primary key (Id)
>     )
>
> but instead I get:
>
>     create table Audit.REVINFO (
>         Id INT not null,                         -- why isn't this the 
> IDENTITY
>        UserFk INT null,
>        RevisionDate DATETIME null,
>        REV INT IDENTITY NOT NULL, -- why is this still here
>        REVTSTMP DateTime null,        -- and this one
>        primary key (REV)                     -- and why isn't this Id
>     )
>
> I figure either the documentation is a little misleading or I'm doing 
> something wrong.
>
> -Patrick
>
>
> On Friday, March 30, 2012 5:11:43 PM UTC-5, Roger wrote:
> I'm not really sure I understand your problem but...
>
> It's mandatory that the revision entity has a revision number and a 
> revision timestamp. However, you can rename it to whatever you want though 
> (both in domain model and in db schema).
>
> It seems you're using attribute configuration? In that case, something 
> like...
>
> [RevisionEntity(typeof(EnversRevisionListener))]
> public class EnversRevisionEntity
> {
>      [RevisionNumber]
>      public virtual long RevisionId {get;set;}
>      [RevisionTimestamp]
>      public virtual DateTime TheTimeStamp {get;set;}
> }
>
>
> Or if you're using fluent cfg...
>
> public class EnversRevisionEntity
> {
> public virtual long RevisionId {get;set;}
> public virtual DateTime TheTimeStamp {get;set;}
> }
> fluentCfg.SetRevisionEntity<EnversRevisionEntity>(e => e.RevisionId, e => 
> e.TheTimeStamp, new EnversRevisionListener());
>
>
> /Roger
>
> ________________________________
> Från: [email protected]<mailto:[email protected]> [
> [email protected]<mailto:[email protected]>] för Patrick
> Skickat: den 30 mars 2012 17:07
> Till: [email protected]<mailto:[email protected]>
> Ämne: Re: [nhusers] Envers with a PrimitiveType
>
> Thanks for helping me resolve that issue, but I'm having a separate 
> problem now (maybe I need a new thread).  I've tried replacing the 
> DefaultRevisionEntity with one of my own making but in the schema 
> nHibernate is generating (and expecting) both the entities fields (Id & 
> RevisionDate) and the defaults (REV & REVTSTMP).  Any thoughts?  Relevant 
> code and schema are below.
>
>     [RevisionEntity(typeof(EnversRevisionListener))]
>     public class EnversRevisionEntity : DefaultRevisionEntity
>     {
>         public EnversRevisionEntity() { }
>
>         public virtual User User { get; set; }
>     }
>
>     create table Audit.REVINFO (
>         Id INT not null,
>        UserFk INT null,
>        RevisionDate DATETIME null,
>        REV INT IDENTITY NOT NULL,
>        REVTSTMP DateTime null,
>        primary key (REV)
>     )
>
> Thanks,
> Patrick
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "nhusers" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/nhusers/-/olwpYMmefLkJ.
> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/GfRqY11ujWYJ.
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