-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Too many tables in join
PostPosted: Thu Sep 04, 2003 5:28 am 
Newbie

Joined: Thu Sep 04, 2003 4:45 am
Posts: 2
Location: Stockholm, Sweden
Hi,

I keep getting this error from Hibernate with MySQL:

Failed to lazily initialize a collection: SQLException initializing collection: General error, message from server: "Too many tables. MySQL can only use 31 tables in a join"

java.sql.SQLException: General error, message from server: "Too many tables. MySQL can only use 31 tables in a join"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1651)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:889)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:956)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1874)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1538)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:71)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:551)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:140)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:602)
at net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:82)
at net.sf.hibernate.impl.SessionImpl.initialize(SessionImpl.java:2897)
...

Is there something I can do to make Hibernate create smaller queries, or tune MySQL somehow? I'm using Hibernate 2.0.3.

Thanks,

/Anders


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 04, 2003 5:33 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
YOu can set outer-join="false" on associations or, in Hibernate 2.1, use hibernate.max_fetch_depth.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 04, 2003 5:46 am 
Newbie

Joined: Thu Sep 04, 2003 4:45 am
Posts: 2
Location: Stockholm, Sweden
Thanks Gavin,

The outer-join="false" solved it nicely!

/Anders


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.