use of org.apache.gora.orientdb.query.OrientDBResult in project gora by apache.
the class OrientDBStore method execute.
/**
* {@inheritDoc}
*/
@Override
public Result<K, T> execute(Query<K, T> query) throws GoraException {
String[] fields = getFieldsToQuery(query.getFields());
OrientDBQuery dataStoreQuery;
if (query instanceof OrientDBQuery) {
dataStoreQuery = ((OrientDBQuery) query);
} else {
dataStoreQuery = (OrientDBQuery) ((PartitionQueryImpl<K, T>) query).getBaseQuery();
}
dataStoreQuery.populateOrientDBQuery(orientDBMapping, fields, getFields());
try (ODatabaseDocumentTx selectTx = connectionPool.acquire()) {
selectTx.activateOnCurrentThread();
OConcurrentResultSet<ODocument> result = selectTx.command(dataStoreQuery.getOrientDBQuery()).execute(dataStoreQuery.getParams());
result.setLimit((int) query.getLimit());
return new OrientDBResult<K, T>(this, query, result);
} catch (Exception e) {
throw new GoraException(e);
}
}
Aggregations