Matt Morton on 30/11/05 15:00, wrote:
I have always wrestled with the DTO question.  I guess I haven't seen the
need for it while using Spring and Hibernate.  I have also created objects
that are specific to the view object (like a set of menu links) that is
being created dynamically and then populated that with the domain objects
values that were needed.   This latter solution is more like a poor mans (in
regards too time) JSF.

In my current project I am at the design stage and one technique I am considering is to implement a view-to-business mapping layer, to live the struts actions, pretty much like BeanUtils, but where I use Spring to set up a configuration specifying the mapping of property to property, with DynaActionForms in my view and lazyloaded dom objects on the other side. So I would do something like this (this is something I haven't even prototyped yet):

<bean parentId="mapper">
  <viewname>accountNumber</viewname>
  <hibname>customer.account.accountNumber</hibname>
</bean>

It would handle type casting and nesting and even arrays.


With regards to the LazyLoading issues for collections that reference other
domain objects I usually use the Hibernate.initialize(Object) method.  It
will then go through and load the objects in the collection that are
necessary for what domain object you are using.  Then send the object back
to the action to be manipulated as necessary.

Probably not perfect but seems to provide the flexibility we need.  I am
interested to know what others are doing too.

I think lazyloading is great for coding and small scale apps, but before it goes into production, I think a high performance app should have lazy loading turned off and all the relationships should be declared specifically with fetch="join".


Adam


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to