• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

best way for storing Java objects into DB

 
Kelahcim Kela
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic