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] [[email protected]] för Patrick
[[email protected]]
Skickat: den 30 mars 2012 17:07
Till: [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
On Sunday, March 25, 2012 11:42:50 AM UTC-5, Patrick wrote:
Okay, I've created a test case with a very basic PrimitiveType that maps an int
in the DB to a class with a char value. It appears to be failing correctly but
please let me know if I messed it up (never used nUnit before either).
https://nhibernate.jira.com/browse/NHE-66
-Patrick
On Thursday, March 22, 2012 3:51:55 AM UTC-5, Roger wrote:
<< Would you be willing to accept a small custom test project?>>
I really would prefer an unit test. A good starting point is to copy/paste a
custom user type test already in envers code base – they are here
https://bitbucket.org/RogerKratz/nhibernate.envers/src/d9c03ac1dbd0/Src/NHibernate.Envers.Tests/Integration/CustomType<https://bitbucket.org/RogerKratz/nhibernate.envers/src/d9c03ac1dbd0/Src/NHibernate.Envers.Tests/Integration/CustomType>
Simply add a new test in that folder and create a patch (or do a pull request
on bitbucket).
Thanks
Roger
From: [email protected]<mailto:[email protected]>
[mailto:nhusers@googlegroups.com<mailto:[email protected]>] On Behalf
Of Patrick
Sent: den 22 mars 2012 01:04
To: [email protected]<mailto:[email protected]>
Subject: Re: [nhusers] Envers with a PrimitiveType
Having never used nHibernate before it will probably take me a while to get a
test added to the Envers source code, but I'm willing to give it a shot. I'll
start working on it tonight. Would you be willing to accept a small custom
test project?
Anyway, Envers very well may support it and I'm just doing something wrong. If
anybody has an idea of what I might be screwing up (or where to start looking),
I'd appreciate it.
-Patrick
On Wednesday, March 21, 2012 1:50:42 PM UTC-5, Roger wrote:
Custom user types is suppose to work just fine with Envers. Can you send a
failing test (using hbm mapping) here please?
https://nhibernate.jira.com/browse/NHE<https://nhibernate.jira.com/browse/NHE>
________________________________
Från: [email protected]<mailto:[email protected]>
[[email protected]<mailto:[email protected]>] för Patrick
Skickat: den 21 mars 2012 19:28
Till: [email protected]<mailto:[email protected]>
Ämne: [nhusers] Envers with a PrimitiveType
I'm trying to get Envers up and running in my project (based on S#arp Lite) and
am having trouble getting it to work with a custom PrimitiveType. Basically, I
using the Enumeration class from Jimmy Bogard's site:
http://lostechies.com/jimmybogard/2008/08/12/enumeration-classes/<http://lostechies.com/jimmybogard/2008/08/12/enumeration-classes/>
and tying it into nHibernate with an EnumerationType<T> that inherits from
PrimitiveType. That code is mostly stolen from:
http://code.google.com/p/codecampserver/source/browse/trunk/src/Infrastructure.NHibernate/DataAccess/EnumerationType.cs?r=1063<http://code.google.com/p/codecampserver/source/browse/trunk/src/Infrastructure.NHibernate/DataAccess/EnumerationType.cs?r=1063>
My nHibernate mapping for a simple property like this is:
map.Property(x => x.Type,
pm =>
{
pm.Type<EnumerationType<CourseType>>();
pm.Column("CourseTypeFk");
});
However, Envers doesn't seem to be able to deal with it. I just want it to
treat it as its associated primitive type (int) but I'm getting the following
exception:
NHibernate.MappingException was unhandled by user code
Message=Could not determine type for: Enumeration, NHibernate.Envers, for
columns: NHibernate.Mapping.Column(CourseTypeFk)
Source=NHibernate
StackTrace:
at NHibernate.Mapping.SimpleValue.get_Type()
at NHibernate.Mapping.SimpleValue.IsValid(IMapping mapping)
at NHibernate.Mapping.Property.IsValid(IMapping mapping)
at NHibernate.Mapping.PersistentClass.Validate(IMapping mapping)
at NHibernate.Mapping.RootClass.Validate(IMapping mapping)
at NHibernate.Cfg.Configuration.ValidateEntities()
at NHibernate.Cfg.Configuration.Validate()
at NHibernate.Cfg.Configuration.BuildSessionFactory()
at ProcessSystem.Init.DependencyResolverInitializer.<Initialize>b__1()
at
StructureMap.Pipeline.LambdaInstance`1.<>c__DisplayClass8.<.ctor>b__6(IContext
s)
at StructureMap.Pipeline.LambdaInstance`1.build(Type pluginType,
BuildSession session)
InnerException:
Any help would be greatly appreciated.
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/-/Pw0Nkff7kL0J<https://groups.google.com/d/msg/nhusers/-/Pw0Nkff7kL0J>.
To post to this group, send email to
[email protected]<mailto:[email protected]>.
To unsubscribe from this group, send email to
nhusers+unsubscribe@googlegroups.com<mailto:nhusers%[email protected]>.
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en<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/-/ASKN74a-YSYJ<https://groups.google.com/d/msg/nhusers/-/ASKN74a-YSYJ>.
To post to this group, send email to
[email protected]<mailto:[email protected]>.
To unsubscribe from this group, send email to
nhusers+unsubscribe@googlegroups.com<mailto:[email protected]>.
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en<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/-/MaVN8-GvpTwJ.
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.