Request/Response objects

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2010-05-10T19:15:19Z Indexed on 2010/05/10 19:34 UTC
Read the original article Hit count: 170

Filed under:
|
|
|

I'm planning on using CXF's rest implementation. I'm thinking of simply annotating my entity classes with jaxb annotations, such as @XmlRootElement, in order to create response objects. The benefit being avoidance of code duplication. As for the (client) request object, which will be used by a separate web app, I'm thinking of 'copying' the entity classes, removing the orm annotations, and adding jaxb annotations.

Based on the above:

  1. Are there any dangers of creating request/response objects from entity classes?
  2. My entity classes contain relational properties, if I were to annotate them with @XmlRootElement, how can I stop the relational properties from being added (or considered apart of) to the response object?
  3. Is there a better/easier way to create request objects rather than copying the entity classes, removing/adding annotations?

© Stack Overflow or respective owner

Related posts about java

Related posts about rest