aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate.... Is it for me? 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.... Is it for me?" Watch "Hibernate.... Is it for me?" New topic
Author

Hibernate.... Is it for me?

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
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 ]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

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.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate.... Is it for me?