mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-17 22:56:28 +00:00
#1396 merge() with ManyToMany throwing error Referential integrity constraint violation
This commit is contained in:
1 parent
af030e3da4
commit
c23508819f
6 files changed
+133
-11
No files matched your search
@@ -6,6 +6,8 @@ import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.deploy.BeanProperty;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssoc;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -50,6 +52,22 @@ abstract class MergeNode {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the outline beans as a map keyed by Id values.
|
||||
*/
|
||||
Map<Object, EntityBean> toMap(Collection outlines) {
|
||||
|
||||
Map<Object, EntityBean> outlineMap = new HashMap<>();
|
||||
if (outlines != null) {
|
||||
for (Object out : outlines) {
|
||||
EntityBean outlineBean = (EntityBean) out;
|
||||
Object outlineId = targetDescriptor.getId(outlineBean);
|
||||
outlineMap.put(outlineId, outlineBean);
|
||||
}
|
||||
}
|
||||
return outlineMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add to the query to fetch the Ids values for the foreign keys basically.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user