我有 4 个简单的结构表:
Table a - columns: id(generated), x
Table b - columns: id(generated), a_id(fk to a), y
Table c - columns: id(generated), a_id(fk to a), z
Table d - columns: id(generated), b_id(fk to b), c_id(fk to c), w
关系如下:
a->b one-to-many unidirectional;
a->c one-to-many unidirectional;
b->d one-to-many unidirectional;
c->d one-to-many unidirectional;
hibernate 在持久化 a 时执行不正确的插入顺序:
应该是 a,b,c,d
执行:a、b、d 并在没有生成 c_id 的情况下失败
我怎样才能执行正确的命令?
谢谢