• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do I integrate hibernate and REST web service in java?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

0
down vote
favorite
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:

HIBERNATE:

  • 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)?
  •  
    Saloon Keeper
    Posts: 7582
    176
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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?
     
    Jignesh Khatri
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I mean - should I write all my POJOs (hibernate POJOs) and Model files in WS, so that android app can also use the same (if yes than give me example), or there is any other approach to do this?
     
    Sheriff
    Posts: 5555
    326
    IntelliJ IDE Python Java Linux
    • Likes 1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hello Jignesh, welcome to the Ranch!

    Jignesh Khatri wrote:
    0
    down vote
    favorite


    I'm guessing by this that you quite literally copy and pasted this from your duplicate question on programmers stackexchange?

    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.
     
    Tim Moores
    Saloon Keeper
    Posts: 7582
    176
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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.
     
    Jignesh Khatri
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    @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!
     
    Tim Moores
    Saloon Keeper
    Posts: 7582
    176
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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.
     
    Why fit in when you were born to stand out? - Seuss. Tiny ad:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic