Hi All,
I received quite a few mails asking me for sample code for the code generation 
of DAO layer..I would love to share the same ..But as the code is too tightly 
coupled with some of project classes and directory structure (it has evolved 
over a period of time...) and will not be useful as such,I need to clean it a 
bit first and write some simple ant tasks as well so that the code generation 
can work right out of box for any body.
I plan to do this some this week end or latest by next week.So will send a link 
to the sample code as soon as I am finished with that...

regards,
Shirish

-----Original Message-----
From: pat.quinn2009 [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 4:37 PM
To: Sakhare, Shirishchandra
Subject: RE: Design Patterns/Examples


Hi shirish,

Can you send on your sample code. Cheers for all the detail it really does 
help...

Thanks

Pat






>From: [EMAIL PROTECTED]
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: RE: Design Patterns/Examples
>Date: Wed, 29 Jan 2003 09:48:06 +0100
>
>Hi,
>We have used folowing approach..
>
>To access db , we use DAO pattern(refer to Sun's blue prints for more
>details).The DAOs return value objects And all calls to the DAO must go 
>through
>service layer..
>
>So in action classes u get Instance of appropriate service from service 
>factory
>and call the corresponding method..So all the data base access logic  and
>conversion of result set to u r value beans is in service layer.(We have 
>used
>converter classer for the same..One converter per Value bean...)
>Also as service factory is used, u can pretty much change ur servie
>implementation with out afecting the struts layer.
>
>So on struts side ,the action clsses are pretty much simple .They just 
>delegate
>the request.
>In action, we get the data from request.And validate the data and if any
>validation errors, send back to the user.Each form contains value beans as
>thier attributes.So the data from jsps is automatically populated in the 
>form
>beans and the action just has to cast the form bean to appropiate type and 
>call
>getBean or beanList as the case may be..
>
>And as u said, the most important part is how we handle conversion of data 
>from
>primitives to string and vice versa.On form bean, all beans are
>StringBeans...So for each ValueBean we have a corresdpondign String 
>bean..And
>the StringBEan has a method getBean which returns the corresponding 
>valueBean
>after performing the conversions from String to primitive type.Similarly on
>each ValueBEan we have a getStringBEan which performs the conversion from
>primitive to String type.And we have a Utility class ParsingUtils which has 
>all
>the conversion methods...
>
>The most important part is we use CodeGeneration using XSLT to create the 
>value
>BEans,DAOs,COnverters for value beans and the String beans.And for the code
>generation , we use an XML which describes which StroedProc is caled and 
>the
>field names etc etc.So all this conversion methods (getStringBean and
>getBean)are also auto generated.And as we have utility methoda in
>PArsingUtils,this is nto at all difficult.So we dont spend any time at all
>coding data conversion or data access layer.All we need to do is write jsps 
>and
>action classes to delegate...
>
>Hope this is not too lengthy or confusing...I know there are some issues 
>like
>too many Objects are  created(for each bean, a correspondign string bean is
>created etc etc..)but we have found a satisfactory performance for our load
>tests...
>
>If any body s interrested, i can give sample code for code generation as 
>well..
>
>hope this helps,
>regards,
>Shirish
>
>-----Original Message-----
>From: pat.quinn2009 [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, January 28, 2003 9:21 PM
>To: struts-user
>Subject: Design Patterns/Examples
>
>
>
>Hi Guys,
>
>Any one know of some design patterns or examples i could use with struts. I
>want to access a database(Value Objects) allow the user to change the VO
>data, perform some business validation and update the database. I’d like
>some pointers also when working with form beans and vo object whats the 
>best
>way to transfer data between them... should i use vo’s as instance variable
>instead form bean... if so how will i handle java primitives like double’s
>etc..
>
>
>I'm not looking for the answers to all the above but i'd like to review a
>pattern or example which demonstrates the best approach for the above.
>
>
>I have my own ideas but would like to look over some design
>patterns/examples before commencing this work.
>
>Cheers,
>
>Guys
>
>
>
>
>
>
>_________________________________________________________________
>Add photos to your messages with MSN 8. Get 2 months FREE*.
>http://join.msn.com/?page=features/featuredemail
>
>
>--
>To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus



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

Reply via email to