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,

I've been doing a lot with Hibernate/AspectJ recently and I have a comment on:


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

This is actually probably the easiest way. Hibernate has both lifecycle events and a generic interceptor you can define on the Session. They're pretty easy to get at, and I've used them to start cflows quite successfully. Give me even more details and I may be able to help with some specific suggestions.

Cheers,
nick


On Jul 13, 2004, at 12:11 PM, robert kuzelj wrote:

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
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users


Nicholas Lesiecki
Software Craftsman, specializing in J2EE,
Agile Methods, and aspect-oriented programming

Books:
* Mastering AspectJ: http://tinyurl.com/66vf
* Java Tools for Extreme Programming: http://tinyurl.com/66vt

Articles on AspectJ:
* http://tinyurl.com/66vu and http://tinyurl.com/66vv



Back to the top