Hi,

I'm getting org.springframework.transaction.UnexpectedRollback Exception: Transaction rolled back because it has been marked as rollback-only after an org.springframework.orm.ObjectRetrievalFailureExce ption occurs.

PHP Code:
org.springframework.orm.ObjectRetrievalFailureExceptionObject of class [nl.project.model.Itemwith identifier [9]: not found


org
.springframework.transaction.UnexpectedRollbackExceptionTransaction rolled back because it has been marked as rollback-only
    at org
.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:717)
    
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
    
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
    
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
    
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
    
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    
at $Proxy156.getSearchFacetOffers(Unknown Source
The thing is, the transaction is marked as read-only through

PHP Code:
<tx:advice id="txAdvice" transaction-manager="txManager">
    <
tx:attributes>
        <
tx:method name="get*" read-only="true"/>
        <
tx:method name="*" />
    </
tx:attributes>
</
tx:advice
I don't understand why I should get a rollbackexception on a read-only method? So, I got this problem to go away by setting up like so

PHP Code:
<tx:advice id="txAdvice" transaction-manager="txManager">
    <
tx:attributes>
        <
tx:method name="get*" read-only="true" no-rollback-for="org.springframework.orm.ObjectRetrievalFailureException"/>
        <
tx:method name="*" />
    </
tx:attributes>
</
tx:advice
But I'm not really sure if this is "right". Is there any good reason why a read-only transaction should trigger a rollback? Shouldn't I just set no-rollback-for any kind of Exception?

Kind regards,

Marc