I am going to develop which will be web application as well as mobile (android / iOS / windows) application. The database in this application will be managed by Hibernate. Also as it is cross platform application, web service will also be used. What I know so far is:
POJO Files (the getter-setter ones which will create database tables)
Model (the java class which will interact with database)
Controller (basically servlet which will get data from view [jsp], set it in POJO object and pass this object to Model for any of CRUD operation)
View (the jsp pages)
REST WEB SERVICE:
Web service implementation class, which have web methods, which can be called by URL from client, and it can return JSON or XML format data.
So now my question is:
How to integrate these both? Should I put my all POJOs and Model files to web service? If no, than what to do in this situation? If yes, than how to do that (simple example)?
What do you mean by "integrate"? If the REST WS is part of the web app, then the two parts can run alongside one another using the same set of classes. Or were you planning to run the WS as its own web app?
While we don't mind if you cross post your questions to other sites, we do ask that you Be Forthright When Cross Posting To Other Sites so that our users here don't waste their time answering a question that's already been answered elsewhere.
I'm not sure what you mean by "so that Android app can also use the same". All classes used by the app will be installed on the app, so they will definitely be separate from whatever the web app and WS use.
@TimCooke - The duplicate question you are talking about is asked by me only, on StackExchange. I haven't got any solution there yet, that's why I asked same question here. I am glad that here (on codeRanch) atleast I am better getting response as compared to StackExchange. So it will be better if you can help me solve my problem, instead of pointing my question as duplicate.
@TimMoores - I am talking about the files which will interact with the database (basically, here, hibernate POJOs and Model files). I want these same files to be used by both - web app as well as android app, instead of creating different POJOs and Model for web app and android app. I know this is possible through WS, but how that I don't know. That's only my question!
I see, by "used by the Android app" you mean "used by the WS that gets called by the Android app". The WS can be part of the web app, so there's no problem using the same classes for both the web app and the WS.