File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Emili Calonge
Ranch Hand
Posts: 84
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic