0

I have the following envers configuration:

        hibernateCfg.SetEnversProperty(ConfigurationKey.DefaultSchema, "audit");
        hibernateCfg.SetEnversProperty(ConfigurationKey.RevisionFieldName, "Rev");
        hibernateCfg.SetEnversProperty(ConfigurationKey.RevisionTypeFieldName, "RevType");
        hibernateCfg.SetEnversProperty(ConfigurationKey.AuditTableSuffix, "_Audit");

        var cfg = new FluentConfiguration();
        cfg.SetRevisionEntity<RevisionInfo>(x => x.Id, x => x.RevisionTimestamp, new RevisionListener());

        cfg.Audit<User>().Exclude(x=>x.Account).Exclude(x=>x.Agentie).Exclude(x=>x.Location).Exclude(x=>x.Produse).Exclude(x=>x.Roles);
        //cfg.Audit<Account>().ExcludeRelationData(x => x.Users);
        //cfg.Audit<Document>();

        hibernateCfg.IntegrateWithEnvers(new EnhancedAuditEventListener(), cfg);

No Audit Table is created and no data is saved. I have tried creating the table audit.User_Audit myself, but nothing changes. I have nhibernate envers 1.30 and nhibernate 3.3.1.

Do I need another configuration to make this work?

Roger
  • 1,944
  • 1
  • 11
  • 17
Catalin
  • 87
  • 2
  • 6
  • I can't see anything wrong. Are you sure that "hibernateCfg" is the configuration you build your ISessionFactory from? Entity User has more properties than those you exclude? – Roger Jan 14 '13 at 18:26
  • Yes hibernateCfg was ok. The problem was with the User entity(Explained below). Thanks – Catalin Jan 16 '13 at 09:07

1 Answers1

0

I solved it. The problem was that I had some derived classes from User (Like BrokerUser : User) which I used with discriminators. After I added:

cfg.Audit<BrokerUser>()

the problem was solved.

Catalin
  • 87
  • 2
  • 6