【发布时间】:2019-05-15 07:40:33
【问题描述】:
我在服务上定义了这个方法
@Transactional
public void delete(Shop shop) {
if (LOG.isDebugEnabled()) {
LOG.debug("deleting Shop1 [ " + shop + " ]");
}
shop.getPurchases().stream()
.forEach(p -> purchaseService.delete(p));
shop.getPurchases().clear();
if (LOG.isDebugEnabled()) {
LOG.debug("deleting Shop2 [ " + shop + " ]");
}
shopRepository.delete(shop);
}
我也定义了这个属性:
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
hibernate.dialect=org.hibernate.dialect.MySQLDialect
但是当我运行删除一些商店的方法时,我在控制台中没有看到任何删除语句并且商店没有被删除
【问题讨论】:
-
您非常具体地提到了 Spring Boot 2.1.4...您是否尝试过使用其他版本的 Spring Boot?说 Spring Boot 1.x?
标签: spring hibernate spring-boot jpa spring-data-jpa