wood burning stoves*
The moose likes Object Relational Mapping and the fly likes best way for storing Java objects into DB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "best way for storing Java objects into DB" Watch "best way for storing Java objects into DB" New topic
Author

best way for storing Java objects into DB

Kelahcim Kela
Greenhorn

Joined: Aug 17, 2007
Posts: 29
Hello Cameron,

I have few questions regarding your book and hibernate in general.

I have done a research, a year ago, for a project. We were supposed to find the best way for storing Java objects into DB.

Hibernate had been one of our candidates but we have to drop it. Here comes few answer to the obvious question: "why?"

1. We had a lot of problems related to SQL queries that contained left, right joins - time consumption for these queries implemented with Hibernate was very high
2. The same issue we have encountered while it came to sub-queries.

Basing on my experience I have two questions regarding your book.

1. Do you cover more complicated usage of database queries than simple storing (serializing) objects? (that's what I find Hibernate very good for)
2. What, in your opinion, is the best way to implement left, right joins using Hibernate.

Thanks in advance for the answers

Cheers

Michal

[ June 04, 2008: Message edited by: kelahcim kela ]
[ June 04, 2008: Message edited by: Bear Bibeault ]
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

1. Do you cover more complicated usage of database queries than simple storing (serializing) objects? (that's what I find Hibernate very good for)
2. What, in your opinion, is the best way to implement left, right joins using Hibernate.



The book does touch upon doing fairly complicated database queries with Hibenrate, with some of it done through HQL and named queries, and others covered through the use of the Hibernate Criteria APIs Example and Restrictions Criterion classes.

The nature of the beast is the fact that sometimes you'll run into queries that you know you could implement faster with JDBC or your own queries, and as such, you can issue native SQL with Hibernate, just as you can HQL queries, although the returned data isn't always as easy to work with.

Sometimes a restructuring of a database can alleviate the need for complex inner or outer joins. Sometimes a recurrence of such things might be an indication a restructuring may be in order. Of course, we don't always have that luxury. So, a solution many clients use is a combination of native SQL with Hibernate.

Hibernate, like anything else, is a tool for a particular job. But sometimes, the job at hand might be better suited for a different tool. No ORM framework is perfect for every situation, and knowing when to use Hibernate is just as important as knowing when not to use it.

-Cameron McKenzie
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

kelahcim kela, since many of this week;s topics will be about the book "Hibernate Made Easy", using that as the title for your topic isn't the best of ideas. What if everyone asking a question about the book did so?

Please try to use more descriptive titles when posting.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: best way for storing Java objects into DB
 
Similar Threads
Hibernate - Query language independency
Best practices in using Hibernate
Persistence in the Enterprise - efficiency
Hibernate Hell
So much on the Left Joins in Hibernate