I have a method annotated with @Transactional. I retrieve an object from my Oracle DB, change a field, and then return from the method. I forgot to save the object, but discovered that the database gets updated anyway.
applicationContext
<tx:annotation-driven />
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
my method
@Transactional
public void myMethod(long id) {
MyObject myObj = dao.getMstAttributeById(id);
myObj.setName("new name");
//dao.update(myObj);
}
my question is why does MyObject get persisted to the database?