
Originally Posted by
lucasward
That's interesting, I see that you have set the validation exception to not cause rollback, but you haven't set it as skippable. There may be a bug preventing it from causing the job to fail when it should, because if you haven't set the validation exception to be skippable, that's what should happen.

Originally Posted by
Dave Syer
If the exception is not skippable but isn't marked for rollback then it's just a misconfiguration? Or maybe a bug in the writer? I would probably expect in that case that data could be modified persistently, depending on what the reader and writer do.
Make sure you are flushing the Hibernate Session somewhere as well (e.g. in ItemWriter.flush(), or by using the HibernateAwareItemWriter).
hi, thanks for the replies 
Regarding your observations that that my exception isn't marked for roll back - doesn't my configuration define that the validation exception should roll back? As opposed to the "+" prefix, which does specify "no rollback"?
Code:
<property name="transactionAttribute" value="-org.springframework.batch.item.validator.ValidationException" />
This is what it states in the sample config here:
http://static.springsource.org/sprin...tml#skipSample
Would I be correct in thinking that if I set this to "+" to not rollback, then I should expect both updates and inserts in my original scenarios (i) and (ii) would be persisted regardless of the exceptions?
If I make my exception skippable:
Code:
<property name="skippableExceptionClasses" value="org.springframework.batch.item.validator.ValidationException"/>
my batch process stops dead after the first validation exception, but when these validation exceptions occur I do want the database transactions to be rolled back, and I only want the process to exit due to validation exceptions once the specified skip limit has been reached.
I am already using the HibernateAwareItemWriter:
Code:
<bean id="hibernateItemWriter"
class="org.springframework.batch.item.database.HibernateAwareItemWriter">
<property name="sessionFactory" ref="hibernateSessionFactory" />
<property name="delegate" ref="hibernateFXRateWriter" />
</bean>
So, I don't need to worry about flushing the writer?
Thanks
G