Results 1 to 5 of 5

Thread: Hibernate Search and Envers - ideas needed

  1. #1

    Default Hibernate Search and Envers - ideas needed

    Hi All

    Firstly, congratulations on the release of ROO. I have just started playing around with it today and it looks very interesting indeed.

    I have a new project that I would like to give a ROO a run on. I am keen to use both Jboss Envers as an audit layer and also Hibernate Search. I am guessing that these libraries could be introduced as add-ons at somepoint. Presumably to use these libs at the moment, I will need to introduce a layer of Repositories that can handle the extra finder methods that I will need to make use of Envers and Search; or should I be looking at doing something a little fancier with AspectJ? (I have no experience with AspectJ just yet).

    Any pointers are much appreciated.

    Jon

  2. #2

    Default

    Hi,

    Don´t take me too serious since i´m not part of Roo´s team but as long as i know you can add whatever you want just as you do in a normal java project, roo uses aspectj for adding functionality to your code but the final result is a usual aspectj unaware java class so you don´t need to worry about aspectj.

    Use any libraries you want and forgot aspectj

    Regards

  3. #3
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    I'm not sure how Envers works, but in the past whenever I have built these sort of audit solutions I have tried to hook into the Hibernate event model directly. It's quite an elegant approach, as you find out every read/update/create operation - even those that happen via transparent persistence of entities with long navigation trees (eg foo.getBar().getCar().setComment("blah")). I find intercepting calls to repository or services layer methods a little less elegant, as while you can determine the most obvious thing happening (eg repo.update(Person)), you generally don't determine if some nested property within Person was modified.
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

  4. #4
    Join Date
    Jul 2009
    Posts
    7

    Default

    After a quick look, it does indeed look like Envers uses the Hibernate event mode:

    http://www.jboss.org/envers/quickstart.html

    Cool! I've had to do the Hibernate interceptors to handle this so many times in past applications.

    I'm not familiar enough with Roo to figure out if there's any problem with introducing Envers into the mix - but the generated persistence.xml looks like it could be easily modified as necessary. No?

  5. #5

    Default

    Yes, that's right. It is just a case of configuring persistence.xml with the event listeners and of course adding the dependency from the Jboss repository.

    Entities can then simply be annotated with @Audited. Envers then allows entities to be queried for in a temporal fashion and return a Snaphot. These queries would appear in additional hand-crafted Repositories for now, but I guess, later, they could exisit as dynamic finders in Roo via an add-on?

    Jon

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •