mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1747 - Refactor extract common code for SaveManyElementCollection preElementCollectionUpdate()
This commit is contained in:
@@ -2,7 +2,6 @@ package io.ebeaninternal.server.persist;
|
||||
|
||||
import io.ebean.SqlUpdate;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.server.core.PersistRequestBean;
|
||||
import io.ebeaninternal.server.deploy.BeanCollectionUtil;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
@@ -29,18 +28,10 @@ class SaveManyElementCollectionMap extends SaveManyBase {
|
||||
}
|
||||
|
||||
Object parentId = request.getBeanId();
|
||||
SpiEbeanServer server = request.getServer();
|
||||
if (!insertedParent) {
|
||||
request.preElementCollectionUpdate();
|
||||
SqlUpdate sqlDelete = many.deleteByParentId(parentId, null);
|
||||
server.execute(sqlDelete, transaction);
|
||||
}
|
||||
preElementCollectionUpdate(parentId);
|
||||
|
||||
transaction.depth(+1);
|
||||
|
||||
String insert = many.insertElementCollection();
|
||||
SqlUpdate sqlInsert = server.createSqlUpdate(insert);
|
||||
|
||||
SqlUpdate sqlInsert = server.createSqlUpdate(many.insertElementCollection());
|
||||
for (Map.Entry<?, ?> entry : entries) {
|
||||
sqlInsert.setNextParameter(parentId);
|
||||
sqlInsert.setNextParameter(entry.getKey());
|
||||
|
||||
Reference in New Issue
Block a user