Java Hibernate如何调用序列生成器?
我有下一个密码Java Hibernate如何调用序列生成器?,java,hibernate,Java,Hibernate,我有下一个密码 getEntityManager().persist(country.getCity().getClinic().getPatient()); 并查看日志中的下一个sql Hibernate: select next value for patient_seq from dual_patient_seq Hibernate: select next value for clinic_seq from dua
getEntityManager().persist(country.getCity().getClinic().getPatient());
并查看日志中的下一个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
但并没有生成“国家”的序列。所有XML都是正确的。什么问题?谢谢,托马斯!问题出在“级联”中。我将City.hbm.xml从
<set name="countrysPersistent" lazy="true" inverse="true" >
<key column="country" />
<one-to-many class="Country" />
</set>
到
这很有帮助 关于实体,特别是关系的更多信息?是否定义了级联等?
country
是否已持久化?序列通常在实体类/hbm xml中定义,请验证序列生成器是否为country定义。
<set name="countrysPersistent" lazy="true" inverse="true" cascade="all">
<key column="country" />
<one-to-many class="Country" />
</set>