• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet + Hibernate

 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can servlets be integrated with Hibernate?
 
Tim Moores
Saloon Keeper
Posts: 3336
61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what you mean by "integrate", but Hibernate is frequently used in Java web apps. Being DB-related it should generally be in a layer that's separate from the web layer (i.e., the servlet), so the class extending HttpServlet would not normally have Hibernate code in it.
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply. I mean that can it be used in DAO classes?
I have a pojo class, a servlet class, and a DAO(containing db related stuff) class.
 
Tim Moores
Saloon Keeper
Posts: 3336
61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use it wherever you want to. I was merely pointing out that DB code and servlet code should be separated.
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for you reply Tim. I will try and will post here if i face any difficulty.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!