-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Extending the envers audit tables in hibernate 5
PostPosted: Thu Dec 01, 2016 11:09 am 
Newbie

Joined: Wed Nov 30, 2016 7:08 pm
Posts: 3
We are currently using Hibernate 4.1.7 and in our application we extend the *_AUD tables with a few columns. Our current implementation used an EnversIntegrator (which received the integrate() call) to wrap the Configuration object in a proxy and then to intercept the Configuration.addDocument() calls. Once intercepted, we added the columns to the document description and then forwarded the call to the real Configuration object. This worked well for us. We use Hibernate to generate the schema (sql scripts) and they correctly contained the added columns.

Now we are moving to the latest Hibernate 5 release and it seems the Configuration object is essentially deprecated. The integrate call now gets a Metadata object rather than a Configuration object. What is the best way to implement our audit table extensions with the latest Hibernate version?

BTW in addition to extending the audit tables we also create archive tables which are used to migrate records from the audit tables. These tables were also added during the addDocument() intercept and again worked well for us.

Any help/direction would be most appreciated!

Thanks.


Top
 Profile  
 
 Post subject: Re: Extending the envers audit tables in hibernate 5
PostPosted: Mon Jan 30, 2017 7:31 pm 
Hibernate Team
Hibernate Team

Joined: Wed Jun 15, 2016 9:04 am
Posts: 24
Unfortunately, there isn't a good way to implement what you were able to do in Hibernate 4. In 5.x, Envers now contributes a ServiceLoader implementation of org.hibernate.boot.spi.AdditionalJaxbMappingProducer that basically provides ORM with a collection of MappingDocument(s) which it uses as part of org.hibernate.boot.model.process.spi.MetadataBuildingProcess.

I would like to understand what are the additional columns you're adding and their purpose?
Are you using them as part of custom event listeners?


Top
 Profile  
 
 Post subject: Re: Extending the envers audit tables in hibernate 5
PostPosted: Mon Feb 06, 2017 5:01 pm 
Newbie

Joined: Wed Nov 30, 2016 7:08 pm
Posts: 3
We solved the integration issue by providing a hook directly in AdditionalJaxbMappingProducer - not ideal but it works.

The additional fields are actually related to archiving. We also produce a mapping for an archive table related to the original entity - very similar to what envers does in creating an audit table.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.