Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] cflow or something like that

hi ron,

thanks for your suggestions.

1) An option that might work for you is
>to use load-time weaving. E.g., you could
>weave into the Hibernate code for your
>application's classloader to track cflow
> of execution from Hibernate.
i know that loadtime weaving can be used, BUT
- i dont have any experience
- the docs are rather scarce at the moment
- i have little time on my hands
- it needs to run with tomcat

in any case its to risky to go that way but it is
definitly an option for later.

2) Another idea that might work is if there is some
> a well-defined set of code that you do control that
> is the alternative to the code you want to identify.
> Then you might be able to use
>!cflow(jpThatDoesntTrigger()) to get the cases that
> were called by Hibernate.
i understand. but dont see anything obvious at the moment.

Hibernate does have some lifecycle events. Can you
i could but i was looking for a an easier way.

> use them? What are you trying to do?
i want to cut of fields at a max size before they get
written to the DB. the max len is defined in some
xml files i read.

aspect TrackExternalCflow percflow(entryPoint()) {
    pointcut entryPoint() : execution(* MyFacade.*(..));
    boolean calledByHibernate;

    before() : entryPoint() {
        calledByHibernate = checkCallByHibernateFromStackTrace();
    }

    before() : execution(* B.executeB()) {
        if(calledByHibernate) {
            // your advice here
        }
    }
}
cool. i will remember that as soon as i get into performance issues.
the only issue here is that i do indeed have something facade like
under my control. sadly this facade is part of an other subproject.
but i'll probably can work around this by using a abstract aspect
on the facade and a concrete one when weaving B.executeB.


ciao robertj

ciao robertj


Back to the top