I avoid a DTO layer in web applications, but I ended up using a DTO layer for Hibernate with Axis2.
It turned out to be faster to do it that way than try to do a work-around. For my setup, the Hibernate BOs get mapped into DTOs, and the DTOs are passed back to the web service layer which then copies the data into XML Beans. That's two copies of data being made, but I end up with a business logic/persistence layer that is massively reusable and neatly wrapped up in a jar file. You could pass back Hibernate BOs directly, and just use XML Beans as your DTOs.. but I think you will still have to make copies of the persisted objects to avoid problems with those objects having their session closed. (I.e. still be able to use lazy loading if you already are) If you start putting Hibernate specific logic into your web service layer code, I think you will regret it later. On 2/12/07, Anne Thomas Manes <[EMAIL PROTECTED]> wrote:
Write a DTO layer. Web services is a loosely coupled system. You should not be attempting to use the same BOs on client and server. On 2/12/07, Faheem Sohail <[EMAIL PROTECTED]> wrote: > > > > > I am using try to expose hibernate generated BOs via webservices to Java > webservice clients. I want to use the same BOs on both the server and client > side. However, apache axis's java2wsdl converts Set to Object[] thus > creating a new object on the client side. Also, in most cases, the > webservice doesn't deploy at all if it has a Set definition in it. I want to > avoid writing a DTO layer. Any ideas? > > > > --------------------------------------------------------------------- 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]
