Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate - Slow Query on Entity Superclass

 
Riaan Nel
Ranch Hand
Posts: 160
IntelliJ IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What SQL is Hibernate generating?
 
Riaan Nel
Ranch Hand
Posts: 160
IntelliJ IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic