Announcement Announcement Module
No announcement yet.
Hibernate Search and Envers - ideas needed Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.


  • #2

    Dont take me too serious since im not part of Roos 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 dont need to worry about aspectj.

    Use any libraries you want and forgot aspectj



    • #3
      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.


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

        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
          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?