0
如果我有一個交易如下,其中我的域對象映射爲Cascade.ALL使用Hibernate:我是否需要在spring事務中顯式保存修改的域對象?
@Transactional
public void transactionAllMethod(Domain domain) {
domain.addItemToCollection(new Item);
//Do I need to call domain.saveOrUpdate() here, or will changes to the domain be flushed
//automatically at the end of the transaction with FLUSHMODE.AUTO?
Domain domain2 = new Domain();
//set some fields here
//Do I need to save my second domain as it is new, or again will things be
//automatically persisted during dirtychecking at the end of the transaction?
}
如果我不需要在任何情況下顯式保存,在那裏我應該這樣做呢?