In my application - I have to expose services using JAX-RS(for mobile platform) and consume the same set of services in a JSF based web app.
Now, I have
@Entity beans for persistence layer,
@ManagedBean beans from presentation layer and another set of beans for mapping
Lets take login operation for example -
Case 1 - Consuming services from mobile devices - a rest request comes in, then my application receive the request data in rest service related
LoginRS object and then pass it to the persistence facade which in turn first maps
LoginRS attributes to
Login entity and then does the necessary validation.
Case 2 Consuming from web app - similarly as above the
managed bean attributes to rest related
LoginRS and then as stated in
case 1 to login entity before the necessary validation kicks in. Here, I can think of another approach which is to pass the managed bean straight to the persistence facade for conversion and validation but then it defeats the purpose of consuming web service.
Question - Is there a better way to deal with the above scenario? Or, is it possible to avoid three types of beans?
I'm not using
EJB but open to both of them if required.
Also, please feel free to edit the tags as you see fit.