Hello all,
I've a simple question (I hope).
I have a EJB that stores serveral Tag objects.
This is done in a for loop, and at the end of each loop I make a call to my persist method.
The persist method is hidden behind a Delegate class.
Now the persist is done, but not each time around the loop.
All the Tag objects get persisted when the for loop finishes and the EJB ends.
Is there a way I can force/request that the persist of each Tag is done at the end of loop?
Thanks
Jeff Porter.
Hibernate version:
hibernate-3.0
Code between sessionFactory.openSession() and session.close():
Code:
Session hsession = null;
Transaction tx = null;
try {
hsession = factory.openSession();
tx = hsession.beginTransaction();
if (tag.getListOfTagRecords().size() > 0) {
System.out.println("check");
}
hsession.saveOrUpdate(tag);
hsession.flush();
tx.commit();
} catch (Exception e) {
if (tx!=null) tx.rollback();
throw new ApplicationException("Exception: " + e.getMessage(), e);
} finally {
hsession.close();
}
return tag;
Name and version of the database you are using:
MySQL
The generated SQL (show_sql=true):
MySQL Server 4.1