Rob Hills wrote: > Hi Derek, > > Derek Broughton wrote: >> Rob Hills wrote: >> >>> I'd >>> be looking to empower a Manager class with the wherewithall to do the >>> job. I'd create a Manager class for your unnamed third object (UTO) and >>> give it access to the DAO(s) it needs to load/create/persist the UTOs >>> and return them to your Action. >>> >> >> That's what I was suspecting I must need to do, but I'm still having >> trouble >> figuring out how I give a manager access to other DAOs. The Manager >> constructor gets a DAO for it's own object, but how does it access any >> other object's DAO? >> > Ah, that bit's quite easy. Simply add the relevant DAOs to your Manager > as attributes, give them public setters and Spring will do the rest, > injecting the live DAOs at runtime, assuming you've defined the DAOs as > beans in your applicationContext.xml file. > > Make sure your DAO attributes are references to the Interface rather > than the Hibernate implementation. For example, if you've got a UtoDao > interface and a UtoDaoHibernate class, your manager should include > something like this:
Doh... That was the bit I was missing. Thanks a lot. I was being led down the garden path by the fact that the managers specifically reference the one DAO in the constructor. -- derek --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]