mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1748 - Support older JPA API that doesn't have orphanRemoval() or joinColumn.foreignKey()
This commit is contained in:
@@ -69,12 +69,21 @@ class AnnotationAssocManys extends AnnotationParser {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean readOrphanRemoval(OneToMany property) {
|
||||
try {
|
||||
return property.orphanRemoval();
|
||||
} catch (NoSuchMethodError e) {
|
||||
// Support old JPA API
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void read(DeployBeanPropertyAssocMany<?> prop) {
|
||||
|
||||
OneToMany oneToMany = get(prop, OneToMany.class);
|
||||
if (oneToMany != null) {
|
||||
readToOne(oneToMany, prop);
|
||||
if (oneToMany.orphanRemoval()) {
|
||||
if (readOrphanRemoval(oneToMany)) {
|
||||
prop.setModifyListenMode(ModifyListenMode.REMOVALS);
|
||||
prop.getCascadeInfo().setDelete(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user