cascading deletes - EclipseLink Remove Cascade -
i have been developing web application running on glassfish server. utilize jpa eclipselink implementation.
these 2 entity classes. represent relation between them below. when start glassfish server , delete lesson entity, cascade works. deletes of test entities of it. add together lesson entity , test entity related it. when seek delete lesson entity, @ time cascade not work , throws "foreign key constraint" error. after server restarting, cascade 1 time again works. ??? difference? why cascade operation work @ startup?
thank you.
@entity public class lesson implements serializable { ... @onetomany( fetch = fetchtype.lazy, cascade = { cascadetype.merge, cascadetype.remove }, mappedby = "lesson" ) private list< test > tests; ... } @entity public class test implements serializable { ... @manytoone( targetentity = lesson.class, fetch = fetchtype.lazy ) @joincolumn( name = "lessonno", insertable = true, updatable = true, nullable = false ) private lesson lesson; ... }
eclipselink cascading-deletes jpa-2.1
No comments:
Post a Comment