-->
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.  [ 2 posts ] 
Author Message
 Post subject: Bulk Inserts java.lang.StackOverflowError
PostPosted: Sat Mar 04, 2006 5:43 pm 
Newbie

Joined: Fri Oct 17, 2003 6:11 am
Posts: 15
Hibernate version:
3.1
Mapping documents:
..
<class name="Colore" >
<id type="java.lang.Long" name="id" >
<column name="id" />
<generator class="native" />
</id>
<property type="string" name="descrizione" />
<property type="string" name="name" not-null="true" unique="true" />
</class>
....
<class name="Taglia" >
<id type="java.lang.Long" name="id" >
<column name="id" />
<generator class="native" />
</id>
<property type="string" name="name" not-null="true" unique="true" /> <property type="string" name="descrizione" />
</class>
...
Code between sessionFactory.openSession() and session.close():
..
int numberofItems = 40;
HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
List colori = new ArrayList();
List taglie = new ArrayList();
for (int i=0;i<numberofItems;i++) {

final Colore greenGrass = new Colore();
greenGrass.setName("colorAuto"+i);
PersistedObjectManager.persist(greenGrass);
colori.add(greenGrass);

final Taglia taglia = new Taglia();
taglia.setName("autoTaglia"+i);
PersistedObjectManager.persist(taglia);
taglie.add(taglia);

log.debug("Current color and taglia added");
}
HibernateUtil.getSessionFactory().getCurrentSession().flush();
HibernateUtil.getSessionFactory().getCurrentSession().clear();
HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();
..
Full stack trace of any exception that occurs:
[java] Exception in thread "main" java.lang.StackOverflowError
[java] at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:188)
[java] at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1900)
[java] at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2349)
[java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2860)
[java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:771)
[java] at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1289)
[java] at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:2259)
[java] at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:423)
[java] at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:1960)
[java] at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1385)
[java] at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1138)
[java] at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:675)
[java] at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1027)
[java] at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
[java] at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
[java] at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
[java] at org.hibernate.loader.Loader.doQuery(Loader.java:662)
[java] at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
[java] at org.hibernate.loader.Loader.doList(Loader.java:2150)
[java] at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
[java] at org.hibernate.loader.Loader.list(Loader.java:2024)
[java] at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
[java] at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1550)
[java] at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:298)
......
Name and version of the database you are using:
5.0 Mysql
The generated SQL (show_sql=true):
Nothing ... it crash before start to generate it.
[b]Debug level Hibernate log excerpt:[/b
Nothing ... it crash before start to generate it.

Others interested hbm.properties:
hibernate.default_batch_fetch_size 500
hibernate.jdbc.batch_size 5000

Any Ideas ?
I've used also a StatelessSession but the same error occur.....

Bye
Stefano


Top
 Profile  
 
 Post subject: Re: Bulk Inserts java.lang.StackOverflowError
PostPosted: Fri Mar 17, 2006 9:36 am 
Newbie

Joined: Thu Feb 23, 2006 12:12 am
Posts: 3
campanini wrote:

(snip)
......
Name and version of the database you are using:
5.0 Mysql
The generated SQL (show_sql=true):
Nothing ... it crash before start to generate it.
[b]Debug level Hibernate log excerpt:[/b
Nothing ... it crash before start to generate it.

Others interested hbm.properties:
hibernate.default_batch_fetch_size 500
hibernate.jdbc.batch_size 5000

Any Ideas ?
I've used also a StatelessSession but the same error occur.....

Bye
Stefano


Stefano,

What version of the JDBC driver is this? It looks like it's not one of the more current ones from the line numbers in the stack trace. I'd suggest upgrading to Connector/J 3.1.12 or 5.0.0 beta.

-Mark


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.