[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] @DeclareParents and "this"
|
I have an @Aspect (PersistentAspect) that defines an interface
(Persistent), a static class that implements the interface
(PersistentImpl), and an @DeclareParents (that advises @Entity
objects). The interface has a method called save() that is implemented
as follows:
public void save() { operations.save(this); }
operations is the HibernateOperations (from Spring) which wraps the
Hibernate save() method. Calls to entity.save() fail because the "this"
object passed to operations.save() is a PersistentEntity.PersistentImpl
*not* my entity object itself. If I call, instead,
operations.save(entity) manually, everything works as expected.
How can I force "this" to be the object itself? Using the .aj style,
this works with the same interface and a similar implementation (the .aj
style appears to correctly interpret "this"):
public void Persistent.save() { operations.save(this); }
Is it possible to make "this" work?