-
Envers bundled with JBoss AS 7.0.2!
Posted on September 28th, 2011 2 commentsUsing Envers is now even easier! Since version 7.0.2, Envers comes bundled with JBoss Application Server.
To showcase how easy the integration is, I created a small JSF/CDI application, which uses Envers and can be deployed straight to AS7. To build the application I decided to try out JBoss Forge, which turned out to be very easy to use and provided me with a simple one-entity CRUD in no time. Just a few changes made it possible to track changes made to the entity, and view its history.
So if you are using AS 7.0.2, to add Envers to your app you just need to:
- Add
hibernate-enversto thepom.xmlusing theprovidedscope - Add
@Auditedto the entities that you want to audit
To view all the changes necessary in detail, just take a look at this commit (note that the
MANIFEST.MFfile is not required, as I initially mistakenly thought).Apart from storing the changes, you may also want to view the history of an entity. That’s also pretty straightforward. All we need is to create a new JSF view and a CDI bean with a method running a simple history query. Again, this commit shows all the changes needed.

You can deploy the application in two ways:
- Run
mvn clean install, and copy the resulting.wartojboss/standalone/deployments - If you are using Forge, run
forgefrom the checkout directory, and invoke:build, then:as7 deploy
After deployment, you should be able to access the application using
http://localhost:8080/envers-as7-demo. Click on thePersonlink on the left to add, edit, list and view history of the entity.By default, the application uses an example datasource, but if you wish to explore the additional schema generated by Envers you can easily change it to another database by modifying
persistence.xmland creating a new datasource in the AS administration console.As always I invite you to submit feedback on the Envers forum. Have fun!
Adam
- Add
-
How to handle inheritance and @Audited?
Posted on September 8th, 2011 2 commentsSome Envers uses had problems because of the limited flexibility in specifying which fields from superclasses (especially those annotated with
@MappedSuperclass) should be audited or not. We improved a bit in the latest release, by being able to explicitly enumerate the superclasses to audit.But still this is not fully flexible. That’s why Ćukasz Antoniak started a discussion on the Envers forum (http://community.jboss.org/message/624057#624057) to gather remarks and use-cases on how people use Envers with inheritance. Your opinion will be very valuable to us, so please share!
Adam
-
Blending Ruby (on Rails) and CDI on OpenBlend 2011
Posted on September 8th, 2011 No commentsI will have the pleasure to speak on OpenBlend 2011, in exactly a week: 15th September 2011, which will take place in Ljubljana, Slovenia.
Apart from many other interesting presentations, I will be demoing Torquebox & CDI integration. Torquebox is an enhanced JBoss AS, which besides being the regular JEE container everybody knows lets you deploy Ruby applications and provides Ruby integration for various AS components (like clustering or caching). This also includes applications written in Ruby on Rails.
Moreover, you can deploy mixed Ruby and Java applications. And that’s exactly what we will do: deploy an application which has a Ruby-on-Rails frontend (which will provide us with instance code changes) and a CDI/Weld backend (with all the goodies coming from a DI framework, typesafety and Java).
Additionally, everything will run on the brand-new and lightning-fast JBoss AS 7, which is the base for Torquebox 2.0.
See you there!
Adam






Twitter