John Ament [
http://community.jboss.org/people/meetoblivion] created the discussion
"Re: Correct approach for creating a large number of records"
To view the discussion, visit:
http://community.jboss.org/message/575465#575465
--------------------------------------------------------------
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?
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/575465#575465]
Start a new discussion in EJB3 at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]