Thanks for clearing this out for me.
I don't have complex forms, so I'll stick to using BasicDynaBeans as VO.

thanks,
Ovidiu
----- Original Message ----- 
From: "Sumit S." <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, November 14, 2003 11:45 AM
Subject: RE: DTO pattern and WrapDynaBean


We have nested level of objects on the UI...For eg ...each Form has an ArrayList
that holds Objects with properties...If we were to use DynaForms, displaying
data was okay but bringing it back from the browser was a problem because Struts
would construct a DynaBean with an ArrayList with no clue whatsoever about the
objects that need to be inside the ArrayList.

So we had to write our own ValueObjects that we embedded inside the
actionForms..and since we anyways had the VOs we decided to avoid the overhead
of Introspection/reflection.

On the "read from DB" in order to avoid writing code like
resultSet.getInt("age") we are using the RowSetDynabeans to populate data from
the resultSet and then use the PropertyUtils to transfer the data to our VO.
Slightly expensive but the tradeoff point was the reduced level of effort.

Sumit



-----Original Message-----
From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED]
Sent: Friday, November 14, 2003 4:07 PM
To: Struts Users Mailing List
Subject: Re: DTO pattern and WrapDynaBean


Ok, I've understood your concern, and you're right.
Is better to pass the data to a clean DynaBean and this bean to the bussines
layer.
I suppose you're using RowSetDynaClass to create the DynaBeans in the appserver
layer, and I'm planning tu use the same method, but is it really necessary to
use another Value Objet to pass data ?

Ovidiu

----- Original Message ----- 
From: "Sumit S." <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, November 14, 2003 11:19 AM
Subject: RE: DTO pattern and WrapDynaBean


>>>>>>The only thing that will be tied with the Bussines Layer will be
commons-beanutils.jar.
    What about the struts libs ? The ActionForm will be the Bean that is wrapped
inside the DynaBean and it has refs to the struts as well as servlets
package....

Perfromance ..as mentioned we have not yest benchmarked but we have not had any
noticeable impact no the performance of the system when using DynaBeans...We are
using them in the appserver layer though for transferring data from a resultset
into a DynaBean and from there to a Value Object.

Sumit

-----Original Message-----
From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED]
Sent: Friday, November 14, 2003 2:54 PM
To: Struts Users Mailing List
Subject: Re: DTO pattern and WrapDynaBean


Yes, I know it holds the reference, but it could be a reference to any other
JavaBean. The only thing that will be tied with the Bussines Layer will be
commons-beanutils.jar. The ideea is to avoid creating new data transfer objects;
so the real debate here is that if the overhead added by getting the data in the
bussines layer, using reflection/introspection, is smaller than the overhead
added by creating another object and filling it with the data obtained from the
ActionForm and retriving this data in the bussines layer.

Ovidiu

----- Original Message ----- 
From: "Sumit S." <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, November 14, 2003 10:07 AM
Subject: RE: DTO pattern and WrapDynaBean


I have'nt benchmarked the perf, but for our app we were not comfortable with
having the struts libs in the Application layer...The WrapDynaBean holds the
instance of the Action form and hence has references to the struts libs.

Sumit

-----Original Message-----
From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED]
Sent: Friday, November 14, 2003 2:05 PM
To: Struts Users Mailing List
Subject: DTO pattern and WrapDynaBean


 Hi,
I've used until now the DTO pattern to transfer data from action forms to the
bussines layer , but I was wondering if using WrapDynaBean (that I've just
discovered) to wrap the action form an to pass it in a DAO class would have
a major inpact on performance.

For example:
===> in an Action (DocumentAction)

DocumentForm dcForm = (DocumentForm)form;
DynaBean wrp = new WrapDynaBean(dcForm);

DocumentDAO dbo = new DocumentDAO();

dom.insertDocument(getConnection(),wrp);


===>and then in the DAO class
public int insertDocument(Connection conn, DynaBean data){
    StringBuffer sbf = new StringBuffer();
    sbf.append("insert ......").appen(data.get("title")).append(",")
         .append(data.get("author")).append(")");
............................................
}
So the basic ideea is to use the wrapped ActionForm as a DTO.
Anyone has any comments?
Thanx
Ovidiu

ps: I'm reposting this beacause yesterday our mail server had some problems and
I'm not sure it was really posted on the list


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


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


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


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


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


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


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

Reply via email to