wood burning stoves*
The moose likes Struts and the fly likes Spring 2 + Aspectj, no working when fetching objects from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Spring 2 + Aspectj, no working when fetching objects from database" Watch "Spring 2 + Aspectj, no working when fetching objects from database" New topic
Author

Spring 2 + Aspectj, no working when fetching objects from database

Emili Calonge
Ranch Hand

Joined: May 17, 2003
Posts: 84
I'm using aspectj to inject my dao into my domain objects, so I can have only a persist method for every domain object and call it from different actions. The thing is that it was working perfectly until I wanted to delete an object.
If I want to create an object I just use:

and in my Car.class I have:

And this works perfecty. The car object attributes are being filled in the form and then I submit to the action. But now I've created my deleteCar method, and it's not working.

and in the Car.class the method is just a cal to dao.delete(). The thing is that the dao is null. So if instead of the car object being created by Struts, I fetch it from the database, the Car object doesn't get a Dao ovject injected. I thought AspectJ injected the dao on every instance being created, but it's not working on this instance that I fetch from the database. Am I doing something wrong? Is this supposed to work?
Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring 2 + Aspectj, no working when fetching objects from database