#350 - ENH: Add @History findVersions() query ... returning historic versions for a given bean using history view

This commit is contained in:
Robin Bygrave
2015-07-24 16:20:15 +12:00
parent 61a0651439
commit 1ec2f74df9
29 changed files with 500 additions and 111 deletions
@@ -1,8 +1,10 @@
package com.avaje.ebeaninternal.server.query;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import com.avaje.ebean.Version;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -154,6 +156,35 @@ public class CQueryEngine {
}
}
/**
* Execute the find versions query returning version beans.
*/
public <T> List<Version<T>> findVersions(OrmQueryRequest<T> request) {
CQuery<T> cquery = queryBuilder.buildQuery(request);
try {
cquery.prepareBindExecuteQuery();
if (request.isLogSql()) {
logSql(cquery);
}
List<Version<T>> versions = cquery.readVersions();
if (request.isLogSummary()) {
logFindManySummary(cquery);
}
return versions;
} catch (SQLException e) {
throw cquery.createPersistenceException(e);
} finally {
if (cquery != null) {
cquery.close();
}
}
}
/**
* Find a list/map/set of beans.
*/