Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Help with interesting little pointcut: automatically persist @Entity classes

Hi Matthew,

Here is where you can use cflow to good measure:

pointcut insidePersistenceProvider() : cflow(within(PersistenceProvider));

And add   && !insidePersistenceProvider() to your autopersistentEntity pointcut.

Just a warning though, your autopersistentEntity pointcut is looking a
little complex.  I'd try breaking it up or documenting it a bit.  3
months from now, I'm going to guess that you will have no idea what
that pointcut does any more.

--a

> Now this almost does the trick.  Problem is, too many constructor
> invocations are advised:  not only the ones called by the object model
> client or internally by other object model classes, but also the ones
> called by the persistence provider as well, resulting, not
> surprisingly, in a StackOverflowError.
>
> My question:  how can I design a way to only advise constructors
> **not** called by the persistence provider?  Alternatively, how can I
> design a way to only advise constructors called from within the object
> model or from object model clients?


Back to the top