Hello experts!
My class is annotated with org.springframework.transaction.annotation.Transactional like this:
@Transactional(readOnly = true)
public class MyClass {
I then have a dao class:
@Override
public void delete(final E entity) {
getSession().delete(entity);
}
@Override
public void save(final E entity) {
getSession().saveOrUpdate(entity);
}
Then I have two methods in MyClass
@Transactional(readOnly = false)
public void doDelete(Entity entity){
daoImpl.delete(entity)
}
//@Transactional(readOnly = false)
public void doSave(){
daoImpl.save(entity)
}
Saving and deleting works like a charm. But if I remove the @Transactional(readOnly = false) on doDelete method deletion stops working, Saving works with and without the method annotation. So my question is: WHY?