• Post Reply Bookmark Topic Watch Topic
  • New Topic

Combining request/response objects with entity classes  RSS feed

 
Dan King
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!