I would like to use an ASO that contains a business object. However, I can't store the business object directly in the ASO because (a) it will be serialized into the session (along with a lot of related objects) (b) it is associated with a particular database session so needs to be re-created on each request to ensure consistency.
So, instead, I'm storing the key of the business object in the ASO. However, that means that every piece of client code needs to know how to turn the key into the business object - in my case, by knowing a data access object (DAO) that can do it for them. So, here's an example ASO showing my current approach: public class Preferences implements Serializable { private long regionId; public Region getRegion(RegionDAO dao) { return dao.getRegionForId(regionId); } public void setRegion(Region region) { regionId = region.getId(); } } What I would really like to do is use HiveMind to inject the DAO and make my ASO something like this: public class Preferences implements Serializable { private transient RegionDAO dao; private long regionId; public void setRegionDAO(RegionDAO newDao) { dao = newDao; } public Region getRegion() { return dao.getRegionForId(regionId); } public void setRegion(Region region) { regionId = region.getId(); } } So, I'd like to know if this is a safe thing to do. Assuming the preferences might get serialized and re-loaded by the app server or passed around a cluster, how do I make sure that the RegionDAO stays injected but doesn't end up serializing itself (unless it can serialize some kind of stub). Thanks, Paul ------------------ Paul Field Global Markets Research IT Deutsche Bank --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]