Announcement Announcement Module
No announcement yet.
AOP on Hibernate loaded entities Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • AOP on Hibernate loaded entities


    I post here something which should have been done before but I do not success to find it on the Net :

    I have my own DAO class, which inherits HibernateDAOSupport and is loaded thanks to Spring. The transaction is set on it with Spring too, without problem. All is right !

    However, I want to plug AOP functionalities on the Hibernate loaded entities. For example, my DAO allows me managing Products.

    My class Product has the methods :
    • activate
    • cancel
    • ...

    I want to have an AOP behavior on these methods.

    However, as these products are loaded thanks to Hibernate, Spring has not directly (through the Xml configuration files) access to them.

    How can I plug AOP functionalities on these BOs ?
    Is this possible ?

    Thanks per advance,
    Best regards,

  • #2
    You need to use AspectJ weaving for this.



    • #3
      Thanks for your answer.

      I am just looking at this documentation :

      and I am wondering about the behavior of this statement:
      <aop: pointcut id="servicePointcut" expression="execution(* ew.service.*.*(..))"/>
      Can the pointcuts point on a non-Spring bean class ?

      Thanks per advance,
      Best regards.


      • #4
        Spring AOP will work with only spring managed beans.


        • #5
          Arf... OK, I will look at AspectJ a little bit more, in order to see if it could be integrable into our projects.

          Thanks for your answers.