in src/main/java/com/microsoft/spring/data/gremlin/query/GremlinTemplate.java [134:159]
public <T> T insert(@NonNull T object, GremlinSource<T> source) {
final boolean entityGraph = source instanceof GremlinSourceGraph;
if (!entityGraph && source.getIdField().isAnnotationPresent(GeneratedValue.class)
&& source.getId().isPresent()) {
throw new GremlinInvalidEntityIdFieldException("The entity meant to be created has a non-null id "
+ "that is marked as @GeneratedValue");
}
// The current implementation doesn't support creating graphs that contain both edges
// and vertices that have null (generated) ids. In this case, vertex and edge creation
// need to be performed in two consecutive steps.
// TODO(SOON) Add this verification in the GremlinSourceGraphWriter
final List<Result> results = insertInternal(object, source);
if (!results.isEmpty()) {
if (entityGraph) {
return recoverGraphDomain((GremlinSourceGraph<T>) source, results);
} else {
return recoverDomain(source, results);
}
}
return null;
}