-
1. Re: Correct approach for creating a large number of records
jaikiran Dec 10, 2010 10:27 AM (in response to meetoblivion)Could you please post some relevant code and the entire exception stacktrace?
-
2. Re: Correct approach for creating a large number of records
meetoblivion Dec 10, 2010 12:14 PM (in response to jaikiran)well among my issues now is that i'm realizing conceptually, what i'm doing won't work long term. Basically, I have this method that will insert a collection of objects into the database
public void persistAsAGroup(List<Evaluation> evals) {
StatelessSession session = sf.openStatelessSession();
for(Evaluation evaluation : evals) {
logger.info("inserting an eval");
session.insert(evaluation);
}
session.close();
}Part of my issue with this ended up being a discrepancy between the size of the objects in here and hibernate.jdbc.batch_size. When they got to the same size, everything worked fine. I wonder though, should the same code above work correctly if I'm using EntityManager instead of StatelessSession? Why does it generate a new database connection on each insert?
BTW - it may end up that my question is more of a hibernate question rather than a JBoss EJB issue - since it's now looking more like it was started there.