[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] getSessionContext()

It sounds like you really need to reach the target *object* (not the class). The cleanest way is to bind it in your advice:

e.g.
before(StatelessBean sb) : your_pointcut() && target(sb) {
  ...

  sb.getSessionContext().rollback();

}

If you want to access it via the join point object you can do that too:

before() : your_pointcut() {

  StatelessBean sb = (StatelessBean) thisJoinPoint.getTarget ();

}

Having an entity bean extend "StatelessBean" sounds interesting... but I'll leave that part with you!

On 18/05/06, mouna SAHIB <mouna.sahib@xxxxxxxxx> wrote:
Hi all,

I' m wondring how to reach the target class in an aspect in order to call the method: getSessionContext().rollback while throwing an exception!
The target class is an entityBean and extend  the statlessBean class that defines de the method getSessionContext().
I tried to use something like :  thisJoinPointStaticPart.getSourceLocation();  or 

 Signature sig = thisJoinPointStaticPart.getSignature();
Class cl = ((SignatureClass)sig).getClass()

but, still can't reach the target proprly.

Any suggestion please?
thank you!

Mouna

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users





--
-- Adrian
adrian.colyer@xxxxxxxxx