by AgentIcarus · 12y ago · 0 comments
I would, in the limited example given, prefer to have a 'storage' POJO (annotated with the hibernate annotations), and an 'API' POJO (annotated with the JSON and XML perhaps). Then it seems to make sense that if you're changing the underlying storage you would update the storage POJO.
I very rarely want to return the exact object as stored in my database to the API layer - there's business logic and the like that needs to be applied, and transforming the object into something the next layer requires means you can generally implement tighter interfaces.
No comments yet.