Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » J2EE Pattern »

Re: XML as DTO

Narasimha Rao Ch. V.

2003-07-21

Replies:

Just to share some more thoughts…

 

There was a discussion on keeping a common data component to store/update all these XML information into database (in the data layer).

 

Will this approach reduce the development time avoiding, creating multiple components to store data into different tables? Assuming the node name as table name or column name.

 

-Rao.

 

 

 

 

-----Original Message-----
From: An interest list for Sun Java Center J2EE Pattern Catalog [mailto:J2EEPATTERNS-INTEREST@JAVA.SUN.COM]On Behalf Of Shivaji Dutta
Sent: Sunday, July 20, 2003 5:50 AM
To: J2EEPATTERNS-INTEREST@JAVA.SUN.COM
Subject: Re: XML as DTO

 

Hi Rao,

I think project Castor would give a good solution.

It would be great if you could let us know why you would love to have XML as DTO. I have used XML DOM objects is large scale projects as Business objects and they have always been performance overheads. I would think using normal Java Objects or POJOs should be a good solution. In case you would want to integrate to other system and that is the reason why you may have chosen XML as DTO, I would think you might like to use a factory to and selectively use XML or POJO as your DTO.

I think the reason for going for XML as DTO would be of good intrest to the group.

 

Shivaji

"Moore, Gary" <gmoore@TWACS.COM>
Sent by: An interest list for Sun Java Center J2EE Pattern Catalog <J2EEPATTERNS-INTEREST@JAVA.SUN.COM>
07/18/2003 07:14 AM EST
Please respond to An interest list for Sun Java Center J2EE Pattern Catalog

To: J2EEPATTERNS-INTEREST@JAVA.SUN.COM
cc:
bcc:
Subject: Re: XML as DTO

Rao,

I have always preferred the value object via EJB remote (or business
delegate) J2EE patterns as a preferred way to cross the layers.  I prefer
this to XML as I prefer to have the benefits of  a compile time type checked
environment which is lessened with XML object representations.  While XML is
a powerful addition to the computing environment, it is up to the
implementation (as well as the parser) to perform runtime type conversions
and type checking.

If you want a simplified approach (as for development coding effort)
you may want to look into JAXB (Part of Web Services) which is a SUN
extension to bind java object to XML and visa versa. A good intro can be
found in the Web Services tutorial (Chapter 9) at:
http://java.sun.com/webservices/docs/1.1/tutorial/doc/

It simplifies the task by creating java objects based on XML schema.
This is defined as a pre-compile step, so it would be something you would
want to incorporate into your build process (ant ot whatever).  I currently
did something very similar to this, as I passed XML from remote JVM to
remote JVM. I used a java object and then made that object responsible for
serializing itself (not via java.io.Serialization, but same term) to and
from XML. This way the remaining clients of the object remained unaware of
the XML nature of the protocol and transfer.

Hope this helps you out.

Thanks,
Gary

-----Original Message-----
From: Narasimha Rao Ch. V. [mailto:narasimharao@WINFOWARE.COM]
Sent: Friday, July 18, 2003 1:48 AM
To: J2EEPATTERNS-INTEREST@JAVA.SUN.COM
Subject: XML as DTO


We were thinking of implementing XML as DTO between Presentation and
Business Layer. Database won't support record sets from XML but it retrieves
record sets as XML. In this scenario is it a viable solution to use XML as
DTO or Plain Objects are better to use as DTOs?
In the earlier scenario system has to extract and build the domain object
from the XML. Any body has any idea of a solution to build domain object
from the XML?
-Rao

====================================================================
Community Web Site (Core J2EE Patterns Catalog - Online Version):

http://java.sun.com/blueprints/corej2eepatterns
Getting Started (Beta Version):

http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/
Get the book:

http://www.amazon.com/exec/obidos/ASIN/0130648841/corej2eepatte-20
List Archive:

http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing:

email "signoff J2EEPATTERNS-INTEREST" to listserv@java.sun.com

====================================================================
Community Web Site (Core J2EE Patterns Catalog - Online Version):

http://java.sun.com/blueprints/corej2eepatterns
Getting Started (Beta Version):

http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/
Get the book:

http://www.amazon.com/exec/obidos/ASIN/0130648841/corej2eepatte-20
List Archive:

http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing:

email "signoff J2EEPATTERNS-INTEREST" to listserv@java.sun.com

======================= Community Web Site (Core J2EE Patterns Catalog - Online Version): http://java.sun.com/blueprints/corej2eepatterns Getting Started (Beta Version): http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/ Get the book: http://www.amazon.com/exec/obidos/ASIN/0130648841/corej2eepatte-20 List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@java.sun.com

©2008 junlu.com - Jax Systems, LLC, U.S.A.