nhibernate-envers

How to access AuditReaderFactory in spring boot application?

…衆ロ難τιáo~ 提交于 2021-02-04 15:41:45
问题 I am using spring boot and spring data jpa. I am also using hibernate envers and I need access to AuditReaderFactory so that I can write Audit Queries. Since, its a spring boot and spring data jpa, everything is auto configured. So when I do this, @Autowired AuditReaderFactory auditReaderFactory; It doesn't work. I get the following error. org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.hibernate.envers.AuditReaderFactory] found for dependency:

Inject service into Nhibernare Envers to customize revision entity

╄→尐↘猪︶ㄣ 提交于 2021-01-26 02:08:46
问题 I'am using NHibernate and envers in a .net 5 web application, i need to add user id to default revision entity and find no way to use dependency injection to do it. this is envers configuration private static void SetupEnvers(NHibernate.Cfg.Configuration cfg) { var enversConf = new NHibernate.Envers.Configuration.Fluent.FluentConfiguration(); enversConf.Audit<Persona>(); IRevisionListener revListner = new EnversRevisionListener(new IUserManagement); enversConf.SetRevisionEntity<RevisionEntity

Inject service into Nhibernare Envers to customize revision entity

左心房为你撑大大i 提交于 2021-01-26 02:07:44
问题 I'am using NHibernate and envers in a .net 5 web application, i need to add user id to default revision entity and find no way to use dependency injection to do it. this is envers configuration private static void SetupEnvers(NHibernate.Cfg.Configuration cfg) { var enversConf = new NHibernate.Envers.Configuration.Fluent.FluentConfiguration(); enversConf.Audit<Persona>(); IRevisionListener revListner = new EnversRevisionListener(new IUserManagement); enversConf.SetRevisionEntity<RevisionEntity

Inject service into Nhibernare Envers to customize revision entity

左心房为你撑大大i 提交于 2021-01-26 02:07:11
问题 I'am using NHibernate and envers in a .net 5 web application, i need to add user id to default revision entity and find no way to use dependency injection to do it. this is envers configuration private static void SetupEnvers(NHibernate.Cfg.Configuration cfg) { var enversConf = new NHibernate.Envers.Configuration.Fluent.FluentConfiguration(); enversConf.Audit<Persona>(); IRevisionListener revListner = new EnversRevisionListener(new IUserManagement); enversConf.SetRevisionEntity<RevisionEntity

nhibernate envers: auditing an entity already in production

一笑奈何 提交于 2019-12-23 17:14:05
问题 We have an application that is already in production and it is using Envers to do auditing. Now we are going to release an update in which we audit a new kind of entity. However this entity already exists in the production environment, only it was not audited so far. We have tried in a test environment containing existings records, and it crashes upon saving because Envers cannot find a previous revision for the entity being saved. What is the approach to takle this issue ? It would be great

Configure an Envers RevisionListener via DI

空扰寡人 提交于 2019-11-29 11:09:22
To add an audit trail to our application we decided to use NHibernate.Envers. To allow app specific tracking of revisions, the DefaultRevisionEntity was extended with user specific data. public virtual void NewRevision( object revisionEntity ) { var revisionData = revisionEntity as Revision; if( revisionData != null ) { // Set additional audit data. var identity = UserAccessor.CurrentIdentity; revisionData.UserId = identity.UserId; revisionData.EmployeeId = identity.EmployeeId; revisionData.UserName = identity.Name; } } Envers decides wich RevisionListener to use depending on the

Configure an Envers RevisionListener via DI

喜你入骨 提交于 2019-11-28 05:19:57
问题 To add an audit trail to our application we decided to use NHibernate.Envers. To allow app specific tracking of revisions, the DefaultRevisionEntity was extended with user specific data. public virtual void NewRevision( object revisionEntity ) { var revisionData = revisionEntity as Revision; if( revisionData != null ) { // Set additional audit data. var identity = UserAccessor.CurrentIdentity; revisionData.UserId = identity.UserId; revisionData.EmployeeId = identity.EmployeeId; revisionData