• 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

Any JSP + Hibernate examples?

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

Can someone point me to any JSP example code that uses Hibernate for database access? (and please don't point me to something that uses Struts - I've found enough of those). I can't seem to find any out there, any help would be appreciated.

Pat
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To be honest, I'd steer away from anything that mixes Hibernate with JSP. A properly constructed web application should sequester all database access in its model layer, which should be completely UI-agnostic.

Your model layer should be usable from a Swing app, a web app, or even a command line app. If you are mixing servlets/JSP and database access in the UI layer, you're not following modern best-accepted practices.
[ July 13, 2007: Message edited by: Bear Bibeault ]
 
Pat Perkins
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, sure, that's what MVC is all about - it would be silly to do DB access from the presentation layer.

I should have been more careful and asked if anyone had a pointer to any examples that used Hibernate in a web application that also makes use of JSP for the presentation, instead of all the Struts and/or EJB junk that seems to accompany all the examples I've found so far.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Understood. But my point, which I may have made badly, is that the interface to the model should be completely transparent as to whether the Model is using Hibernate, iBatis, Jenny, striaght JDBC, or Fred's Fabulous Database Engine.

So there's no need to look for a tutorial that specifically uses JSP and Hibernate, because any touted as such would probably be violating the precept of MVC just because its about both technologies, which should be independent.

If it's the JSP side of things you're needing help with, look for a good modern JSP tutorial (good luck, I haven't found one yet). If it's Hibernate, look for a good Hibernate tutorial.
 
Pat Perkins
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, I guess I was looking for something too specific, but I really had thought that using Hibernate and JSP together would be a common thing and something that a lot of people would have done, and therefore there would be a good chance one of them might have written something about it.

Not finding anything also led me to question, 'Hmm, maybe it is stupid to use Hibernate in a simple JSP-based web app since apparently nobody else is doing it.' Anyway, apparently I was just looking for an over-simple answer, will have to just go and try it myself.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pat Perkins:
'Hmm, maybe it is stupid to use Hibernate in a simple JSP-based web app since apparently nobody else is doing it.'.



Invalid conclusion.

I've used Hibernate for a few JSP-based web applications. But you'd never know it. Which is again, my point. The facts that I used JSP for the front end, and Hibernate for the backend, are completely unrelated and irrelevant.

I could switch any of these apps to use another DB engine (and probably will at some point, not a big fan of Hibernate) without touching a character of the UI code.
 
Pat Perkins
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:

I could switch any of these apps to use another DB engine (and probably will at some point, not a big fan of Hibernate)



Care to elaborate? e.g. what you don't like about Hibernate and especially any alternatives you could suggest.
 
Fire me boy! Cool, soothing, shameless self promotion:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic