外键字段 引起的illegally attempted to associate proxy。
开发语言:java
框架:SSH
A 表有一个外键字段 fd_customer (关联tbl_customer_info表);
B 表也有一个外键字段 fd_customer(关联tbl_customer_info表)。
外层事务中 ,
先查询 的一笔A 表数据,对应的 fd_customer 值为 001。
启动一个新事务,事务传播机制是:PROPAGATION_REQUIRES_NEW
在新事务中:
查询到一笔B 表数据,其对应的 fd_customer 值也为 001。
这个时候如果在这个新事务中再执行 update(b1);
就会抛出异常:
illegally attempted to associate proxy [com.tt.tbl_customer_info#176b6416af7552d18317251498596416] with two open Sessions;