Win a copy of Learn Spring Security (video course) this week in the Spring 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
  • 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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic