Ok, I have now managed to reproduce the problem in a very simple test.
To make things clearer, I have taken out all interceptors and event listeners.
And the test simply retrieves a row and then deletes it.
Now if the test is transactional, then the update occurs before the delete. But if non-transactional, then there is no update before the delete.
I think the difference here will be that when transaction the object is always associated to the hibernate session. But when non-transactional, the object is detached between the retrieve and the delete.
But why this makes a difference I do not know. So can anyone shed some light on this?
Code:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
@TransactionConfiguration(transactionManager="transactionManager")
@Transactional
public class TestHibAbcDAO
{
@Test
@Rollback(false)
public void testRetrieveDelete()
{
SjeVO vo = abcDAO.retrieve(new Long(361463));
abcDAO.delete(vo);
}
}
new mapping
Code:
<?xml version="1.0" ?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="org.....SjeVO" table="SJE_TEST" lazy="false" mutable="false">
<id name="id" type="java.lang.Long">
<column name="id" precision="10" scale="0" />
<generator class="sequence">
<param name="sequence">OPQU_SEQ</param>
</generator>
</id>
<property name="name" column="name" not-null="true"/>
<property name="something" column="SOMETHING" not-null="false"/>
</class>
</hibernate-mapping>