use of io.micronaut.data.model.runtime.InsertOperation in project micronaut-data by micronaut-projects.
the class DefaultJdbcRepositoryOperations method persist.
@NonNull
@Override
public <T> T persist(@NonNull InsertOperation<T> operation) {
final AnnotationMetadata annotationMetadata = operation.getAnnotationMetadata();
final Class<?> repositoryType = operation.getRepositoryType();
SqlQueryBuilder queryBuilder = queryBuilders.getOrDefault(repositoryType, DEFAULT_SQL_BUILDER);
return executeWrite(connection -> {
JdbcOperationContext ctx = new JdbcOperationContext(annotationMetadata, repositoryType, queryBuilder.dialect(), connection);
JdbcEntityOperations<T> op = new JdbcEntityOperations<>(ctx, new StoredQuerySqlOperation(queryBuilder, operation.getStoredQuery()), getEntity(operation.getRootEntity()), operation.getEntity(), true);
op.persist();
return op;
}).getEntity();
}
Aggregations