Dear members,
I am using Hibernate + Spring for the following problem (batch process):
1. Reading the objects from a flat file.
2. Processing the information (validation, checking, etc, some queries are inviked in order to verify some information)
3. Saving into database.
I just want to flush the data just on step 3, becase on step 1, 2 the data probably is are not complete. On the step 2 I have to make some queries in order to verify the data already exist on the data base, etc (before step 3).
So I crearly don't need any synchronization with the input data into data base until I get into step 3, but hibernate makes some flushing in the middle of step 2. I would like to avoid this situation. Do you have any idea how to configure hibernate in order to force the flush will be done only by the user?
The domain objets representing my problem where generated using hbm2java, so they are mapped into the corresponding database tables.
For the step 3 I am using a Dao's extending HibernateDaoSupport Spring class and invoking the method:
Code:
getHibernateTemplate().saveOrUpdate(contract);
for each element to save. I have added some safeguard for flushing the data after a lot of insertions/updates on the Dao Hibernate implementation:
Code:
if (counter % getMaxBatchSize() == 0) {
session.flush();
session.clear();
}
the whole process is embeded on a transaction proxy, so the batch method is transactional.
Do you have any idea about how to control this flush process by the user only, because before to the step 3 Hibernate made some automatic flush operations.
Thanks in advance,