Request/Response objects
- by Dan
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:
Are there any dangers of creating request/response objects from entity classes?
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?
Is there a better/easier way to create request objects rather than copying the entity classes, removing/adding annotations?