Announcement Announcement Module
Collapse
No announcement yet.
Need help with 'Intelligent Data Objects' Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help with 'Intelligent Data Objects'

    Lets say I use (for instance) HttpInvoker to fetch an object from my service tier to my view tier.

    Next, lets give that object the ability to do 'deferred loading' of some data by delegating to other service-tier objects. For instance, we rarely invoke the getUsers() method of CustomerDTO so we don't load that data initially. However, if we later need that in one of our action objects or JSPs CustomerDTO.getUsers() can simply delegate to customerService.getUsers().

    Giving CustomerDTO (or CustomerIDO since its now becoming an 'Intelligent' Data Object) an instance of customerService is easy enough to do when it gets created. However, if it gets created in the service-tier that will be a local reference. Once CustomerIDO gets sent (again, via HttpInvoker) across the wire to the view tier that reference will be invalid.

    We've solved this so-far by *not* giving CustomerIDO an instance of customerService and, instead, forcing it to use a bean singleton. By doing that, we get the local bean on the service side and the bean proxy on the view side. I would like to get rid of the singleton though.

    I've tried to find some kind of "hook" that would fire after the bean has been deserialized on the view tier. My thought was that once I have the hook I can setCustomerService() on the instance and be done. I can't seem to find any such thing though.

    Does anyone have a suggestion? Or is the singleton really the right way to do this?

    One last note: We originally had separate CustomerDTO and CustomerWithUsersDTO objects but it became a nightmare to figure out which one to use. It became a major refactoring effort any time a usage of CustomerDTO needed to be "upgraded" to CustomerWithUsersDTO.

    Thanks,
    James
Working...
X