finish up batch feature for now
This commit is contained in:
parent
41e5d8c1e5
commit
b4dca9c710
1 changed files with 16 additions and 4 deletions
|
@ -145,9 +145,18 @@ public final class InsertOperation<T> extends AbstractOperation<T, InsertOperati
|
||||||
@Override
|
@Override
|
||||||
public BuiltStatement buildStatement(boolean cached) {
|
public BuiltStatement buildStatement(boolean cached) {
|
||||||
List<HelenusEntity> entities = values.stream().map(t -> t._1.getProperty().getEntity()).distinct().collect(Collectors.toList());
|
List<HelenusEntity> entities = values.stream().map(t -> t._1.getProperty().getEntity()).distinct().collect(Collectors.toList());
|
||||||
if (entities.size() == 0) {
|
if (entities.size() != 1) {
|
||||||
throw new HelenusMappingException("you can insert only single entity, found: "
|
throw new HelenusMappingException("you can insert only single entity at a time, found: "
|
||||||
+ entities.stream().map(e -> e.getMappingInterface().toString()).collect(Collectors.joining(", ")));
|
+ entities.stream().map(e -> e.getMappingInterface().toString()).collect(Collectors.joining(", ")));
|
||||||
|
}
|
||||||
|
HelenusEntity entity = entities.get(0);
|
||||||
|
if (this.entity != null) {
|
||||||
|
if (this.entity != entity) {
|
||||||
|
throw new HelenusMappingException("you can insert only single entity at a time, found: " +
|
||||||
|
this.entity.getMappingInterface().toString() + ", " + entity.getMappingInterface().toString());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.entity = entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (values.isEmpty()) return null;
|
if (values.isEmpty()) return null;
|
||||||
|
@ -237,6 +246,7 @@ public final class InsertOperation<T> extends AbstractOperation<T, InsertOperati
|
||||||
// Oddly, this insert didn't change anything so simply return the pojo.
|
// Oddly, this insert didn't change anything so simply return the pojo.
|
||||||
return (T) pojo;
|
return (T) pojo;
|
||||||
}
|
}
|
||||||
|
return o;
|
||||||
}
|
}
|
||||||
return (T) resultSet;
|
return (T) resultSet;
|
||||||
}
|
}
|
||||||
|
@ -307,7 +317,9 @@ public final class InsertOperation<T> extends AbstractOperation<T, InsertOperati
|
||||||
}
|
}
|
||||||
Class<?> iface = entity.getMappingInterface();
|
Class<?> iface = entity.getMappingInterface();
|
||||||
if (resultType == iface) {
|
if (resultType == iface) {
|
||||||
adjustTtlAndWriteTime((MapExportable)result);
|
if (entity != null && MapExportable.class.isAssignableFrom(entity.getMappingInterface())) {
|
||||||
|
adjustTtlAndWriteTime((MapExportable) result);
|
||||||
|
}
|
||||||
cacheUpdate(uow, result, bindFacetValues());
|
cacheUpdate(uow, result, bindFacetValues());
|
||||||
} else {
|
} else {
|
||||||
if (entity.isCacheable()) {
|
if (entity.isCacheable()) {
|
||||||
|
|
Loading…
Reference in a new issue