Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate, too slow, what's wrong?

 
Denis Ku
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have following situation. There are two classes Customer and EMail. Both classed are identified by a composite key (countryId, customerId). I would like to make one-to-one relation between them.

Customer.hbm.xml

It's working, but EXTREMELLY slow. What have I done wrong?
 
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
Set SHOW_SQL to true in the config file and take a look at the SQL that is being generated.

Perhaps you are doing large queries on those two tables that are joined through the surrogate key?

How do you know "it is taking a long time?"

-Cameron McKenzie
 
Denis Ku
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cameron Wallace McKenzie wrote:How do you know "it is taking a long time?"-Cameron McKenzie


When I hadn't this relation, it worked quite fast.
 
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
Remember, Hibernate simply sends SQL through JDBC calls to the underlying database. All of this is abstracted out by the framework, but under the covers, that's all it is. Set the SHOW_SQL to true in the config file and see if anything peculiar is happening in the SQL being generated. Sometimes that can shed light on the situation, or at least provide a place to start.

I'm betting there are large select * or something like that happening on the composite tables for some reason.

-Cameron McKenzie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic