Thursday, October 26, 2006

Aspect, oh Aspect...

Not all is peachy at aspectj land.

If you are using hibernate, you are in for a nasty circular dependency surprise once you inject an object/service/dao to your domain object which has a hibernate session factory injected via spring. The session factory object tries to load your entity/domain, which will be intercepted with aspectj and try to configure using your spring configuration, which will again call on session factory....

The solution is including an unsaved-value="null" into your primary class (use xdoclet to make your life easy).

Am currently using load time weaving using the AJDT tool. And its a bit slow on bookah wookah. A much nicer/lightweight approach is to mock your objects for unit testing and use ajc on the final jar build.

Is it domain dependency injection worth the trouble? It depends, but it truly helps make your model more object oriented. Makes mapping meatspace problems easier. You could treat your domain object just like a real object.

- binding aspects to the jar output...

No comments: