[jboss-user] [EJB3] - Re: Correct approach for creating a large number of records
John Ament
do-not-reply at jboss.com
Fri Dec 10 12:14:10 EST 2010
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&containerType=14&container=2029]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101210/9f5b446a/attachment.html
More information about the jboss-user
mailing list