You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Dan King <da...@yahoo.com> on 2010/05/11 18:04:29 UTC

Creating request/response objects

Hi,

I'm using CXF's rest implementation and I'm in the early stages of putting together my response objects -- I'm doing so by adding jaxb annotations to my previously jpa annotated entity classes (Hyperjaxb3 does something similar; it generates jaxb/jpa annotated classes from a schema). For the request objects, I plan on copying my entity classes, removing jpa annotations and adding jaxb annotations. 

Clearly the benefits of annotating my entity classes, are it eliminates duplication and saves me the trouble of transferring 'information' from/to the DTO (request/response object) from/to the entity classes. 

However, I've recently come across warnings that combining the request/response objects & my entity classes, could potentially expose my underlying db schema and lead to (problematic) coupling of the XML and the entity classes. 

I'm curious as to what is considered "best practice" in this situation. Is it best to separate my request/response objects from my entity classes? If I don't am I setting myself up for problems later?

Thanks,
Dan