The Patient class
The Test class
If anyone have solution please share it.
Thanks.
thanks. i changed it to em.merge() from em.persist(). works fine.
merge
and persist
do pretty different things with your entity. Are you really sure that merge accomplishes what you intended to do in the first place ? (see this topic over here )
Without seeing the code that you wrote to persist the test
- entity, I can't really tell you what went wrong, but I could imagine it having something to do with the manyToMany-relationships that you have there. Are you sure you want to cascade.ALL ? If you remove a test
-instance from the database, the cascade will remove every patient
in that list. And then, for every patient
in that list, it will cascade.REMOVE every test
in the List<test>
.
我建议尝试修改CASCADE_TYPE=PERSIST
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.