wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Hibernate - Slow Query on Entity Superclass Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate - Slow Query on Entity Superclass" Watch "Hibernate - Slow Query on Entity Superclass" New topic
Author

Hibernate - Slow Query on Entity Superclass

Riaan Nel
Ranch Hand

Joined: Apr 23, 2009
Posts: 157

Hi Guys

I have a quick question regarding Hibernate entity mappings.

I have a Java project in NetBeans, using Hibernate as persistence manager, with all the default settings. I have two entity classes in my application; each of them extends the same superclass.

When executing a select query on the superclass, it takes around two and a half minutes. When executing individual queries on each of the two tables, each of them takes less than a second. How can I speed up the query on the super class? We want to be able to run a report over both tables with a single query, but the user should be able to edit each table without affecting the other - therefore we created two tables with a common super class.

I'm no Hibernate expert, so please let me know if you need any additional information.

Thanks and Regards,
Riaan Nel


"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." - George Bernard Shaw
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

What SQL is Hibernate generating?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Riaan Nel
Ranch Hand

Joined: Apr 23, 2009
Posts: 157

Paul Sturrock wrote:What SQL is Hibernate generating?


Hi Paul, thanks for your response. Hibernate is generating a union between the tables for the two subclasses. I'm not sure whether it will be possible to speed it up.

Regards,
Riaan
 
 
subject: Hibernate - Slow Query on Entity Superclass
 
Similar Threads
Hibernate Criteria Could not understand Left Join "ON" condition-- HELP
Multiple Table Data Persistence
hibernate mapping and performance
Polymorphism query in ejb 3 ... pls urgently reply
Mapping Class Inheritance