Hibernate 3.2.6GA
Annotations 3.3.1 GA
MySQL connector 5.1.6
Problem:
I was running a lil bit o code to insert lots and lots of data into a mysql DB. A short while after starting to run this code (that does inserts well, btw), I caught a heap error. While profiling to see where the error was, I noticed that it was the JDBC4ResultSet object that was getting bigger and bigger as inserts went by. The vm crashed after a few hundred thousand inserts (would have been more with more memory, I was on 68M).
Question:
I looked at the code below and can't find a thing wrong. Is there something that could cause this error in the code below? Is there some config parameter that could cause this behavior?
This is a simplified variant of the code I really use, to try and get as simple a test case as I could. There is only one thread running this. I'm getting an intuition that it's either the mysql driver or something hibernate does wrong in using it, but then again, there could be something I don't know about. There are no exceptions thrown, for those who wonder about rollback and stuff...
Code:
for(int x = 0; x<100000; x++){
Transaction tx = null;
try {
SessionFactory sf = sessionFactoryProvider.getSessionFactory();
Session session = sf.openSession();
tx = session.beginTransaction();
for(int i = 1; i<=10; i++){
ConstraintGroup cg = new ConstraintGroup();
cg.setName("CG "+x+"_"+i);
session.save(cg);
}
tx.commit();
session.close();
}
catch (Exception e) {
e.printStackTrace();
}
}