-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: To DTO or not to DTO???
PostPosted: Tue Nov 09, 2004 10:54 pm 
Regular
Regular

Joined: Thu Sep 09, 2004 6:46 pm
Posts: 96
I have read many articles on this topic and in the end all I have ended up being is confused.

Some articles say to use Hibernate Business Objects instead. The problem I see here is that you have to assemble the Business objects and this can involve business logic (conditions as to what data needs to go where, when, selects from the db, validation etc). So the Action class doesn't appear to be the place for this. Refactoring all this logic out into the service layer leave you with one of 2 solutions. a) Method signatures of the service methods either have all the parameters necessary to fulfil the requests or b) Method signatures accept DTOs which encapsulate all the parameters necessary to fulfil the requests. So this is contradictory to the "use Hibernate Business Objects instead".

What is the best option for talking to Service Layer? DTO or not.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 10, 2004 1:41 am 
Regular
Regular

Joined: Thu Jul 01, 2004 12:13 am
Posts: 68
Location: San Diego, CA
We ended up using DTOs with our service layer, but only because we needed to serialize the objects into XML SOAP message. In all likelihood you'll probably use bi-directional relationships in your hibernate objects so that causes circular references and thus cause XML serialization to fail.

Essentially, we used the Hibernate BOs throughout or Java EJB layer, but resorted to DTOs for the service layer. Are DTOs were basically our BOs minus the circular references.

HTH,
Lou


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.