[英]How does Hibernate call sequence generators?
I have next code 我有下一个代码
getEntityManager().persist(country.getCity().getClinic().getPatient());
and see next sql in log 并在日志中查看下一个sql
Hibernate:
select
next value for patient_seq
from
dual_patient_seq
Hibernate:
select
next value for clinic_seq
from
dual_lclinic_seq
Hibernate:
select
next value for city_seq
from
dual_city_seq
But sequence for 'country' isn't generated. 但是不会生成“国家/地区”的顺序。 All XML are allright.
所有XML都可以。 Whan is the problem?
问题出在哪里?
Thx, Thomas! 谢谢,托马斯! Problem was in 'cascade'.
问题出在“层叠”中。 I change City.hbm.xml from
我将City.hbm.xml从
<set name="countrysPersistent" lazy="true" inverse="true" >
<key column="country" />
<one-to-many class="Country" />
</set>
to 至
<set name="countrysPersistent" lazy="true" inverse="true" cascade="all">
<key column="country" />
<one-to-many class="Country" />
</set>
and it was helpful! 这很有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.