jQuery in Action, 3rd edition
The moose likes Object Relational Mapping and the fly likes Hibernate and small web apps Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate and small web apps" Watch "Hibernate and small web apps" New topic

Hibernate and small web apps

Stef Mischook

Joined: Nov 12, 2004
Posts: 15
Is there any point to using JDO or Hibernate for small web apps that may have only a few tables to deal with and perhaps 1/2 dozen queries? Or are these tools more or less show their stuff in the enterprise arena?



<a href="http://www.killersites.com" target="_blank" rel="nofollow">http://www.killersites.com</a><br /><a href="http://www.how-to-build-websites.com" target="_blank" rel="nofollow">http://www.how-to-build-websites.com</a><br /><a href="http://www.websitetemplates.name" target="_blank" rel="nofollow">http://www.websitetemplates.name</a>
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Depends really. I'd think more how likely said "small web app" was to be deployed with a different DB than that it was developed on. Once you get past the initial learning curve I'd say Hibernate was pretty much comparable with JDBC for complecity.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Stef Mischook

Joined: Nov 12, 2004
Posts: 15
In terms of complecity ... yes about the same as JDBC.

In terms of time in development - based on my initial impression I would say that projects with 10 tables or less and only a couple of queries a table you are going to write much less code via JDBC.

I think ORM shines with larger projects.
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
if you already know SQL/your object model is simple, then have a look at ibatis sql maps.
Your SQL queries/inserts/updates are stored in xml files (that is nice if someone else than the java programmer writes the SQL or you want to change to another DB).
This is an select statement in ibatis (taken from ibatis.com)

<select id="getAddress" parameterClass="int"
ADR_ID as id,
ADR_DESCRIPTION as description,
ADR_STREET as street,
ADR_CITY as city,
ADR_PROVINCE as province,
ADR_POSTAL_CODE as postalCode
where ADR_ID = #value#

if you execute this statement, then you will get a prefilled examples.domain.Address object where ADR_ID is like the parameter you pass in. You are not restricted to pass only one paramter: you can also pass maps or beans.

i think it is a nice, thin layer above your database. perhaps a good fit if you do not need a full featured/complex system like hibernate.

Stef Mischook

Joined: Nov 12, 2004
Posts: 15
Hey Pascal,

Thanks for the heads up on Abatis, looks very good.
I agree. Here's the link: http://aspose.com/file-tools
subject: Hibernate and small web apps
jQuery in Action, 3rd edition