Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
  • Tim Holloway
  • Carey Brown
  • salvin francis

Hibernate.... Is it for me?

Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I know this might sound like a daft question, but I have been looking at it for a few days now and can'tdecide if it's for me or not.
I really like the way it treats each DB result as an Object/Bean for adding, deleting, updating etc. This would make my project a lot easier to manage and teh code a lot tidier.
But the plus is also the minus, because surely if Hibernate is creating Objects for each result, this must place a massive strain on the Server/Memory!

The project I am working on currently has a single DB, although I may look to 'horizontal growth' (I believe the buzz term is) in the furture, but initially this DB will have 1,000s of enteries and in the next year will almost certainly hit the 1mill+ mark (and will most likely continue to grow over the next few years)

As I say I plan to spread the DB out into several DBs based on Country (this should limit records to maybe 1-2 million depending on country) but still if I was to do a "SELECT * FROM DB_UK" type of search and the results returned say 2million results, surely this would cripple the Server!

Or am I completely off the mark with my understanding of Hibernate?

Also, if Hibernate is suitable to mass DBs like this, is there a good way of developing DB conn pooling? I have an existing Conn Pool for my old basic JDBC/SQL commands which were called from a Class I wrote, but I very much doubt I can use it with Hibernate

Oh and my DB is initially MySQL, but again if funding is made available will be upgraded to most likely Oracle.


Adding to this...

I think if I understand the site correctly, Hibernate com es with a built in Conn Pool called C3P0!
Hibernate Connection Pooling

It looks like all you have to do, is add some properties to the .properties file for the DB connection, is this correct?

How good/reliable is this C3P0? Is there anything better, or a better way of doing this?

Cheers again.
[ September 11, 2007: Message edited by: Keith Wilson ]
Posts: 17344
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First I am a JBoss employee.

What materials have you looked at so far about learning Hibernate? I highly recommend Java Persistence with Hibernate from Manning publishing.

What you explained is exactly what Hibernate can do and is for.

For your example of 1 million records returned and memory strain, yes it will be for Hibernate and for JDBC. More for Hibernate. But what you learn with Hibernate is the concept of the Persistent State, the Session object, and making sure you keep track of what objects you are loading into it and such. But I would also state that what user can read through 1 million records at once with a "select * from table A", this is again an issue you will find with anything even straight JDBC.

The minus I always state with Hibernate is always that there is a good size learning curve, because it has so much and is so powerful, and covers everything that you will need.

passwords must contain 14 characters, a number, punctuation, a small bird, a bit of cheese and a tiny ad.
professionally read, modify and write PDF files from Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!