use of org.eclipse.persistence.queries.ReadAllQuery in project eclipselink by eclipse-ee4j.
the class ReadAllFirstResultVsRownumFilteringTest method addReadAllRownumFilteringTest.
/**
* Read all employees with scrollable cursor.
*/
public void addReadAllRownumFilteringTest() {
PerformanceComparisonTestCase test = new PerformanceComparisonTestCase() {
@Override
public void test() {
ReadAllQuery query = new ReadAllQuery(Employee.class);
query.setFirstResult(size - 1);
getSession().executeQuery(query);
}
};
test.setName("ReadAllRownumFilteringTest");
test.setAllowableDecrease(350);
addTest(test);
}
use of org.eclipse.persistence.queries.ReadAllQuery in project eclipselink by eclipse-ee4j.
the class ReadAllMaxRowsFirstResultVsRownumFilteringTest method test.
/**
* Read all employees with cursored stream.
*/
@Override
public void test() throws Exception {
ReadAllQuery query = new ReadAllQuery(Employee.class);
getSession().executeQuery(query);
}
use of org.eclipse.persistence.queries.ReadAllQuery in project eclipselink by eclipse-ee4j.
the class ReadAllMaxRowsFirstResultVsRownumFilteringTest method addReadAllRownumFilteringTest.
/**
* Read all employees with scrollable cursor.
*/
public void addReadAllRownumFilteringTest() {
PerformanceComparisonTestCase test = new PerformanceComparisonTestCase() {
@Override
public void test() {
ReadAllQuery query = new ReadAllQuery(Employee.class);
query.setMaxRows(maxrows);
query.setFirstResult(maxrows - 1);
getSession().executeQuery(query);
}
};
test.setName("ReadAllRownumFilteringTest");
test.setAllowableDecrease(300);
addTest(test);
}
use of org.eclipse.persistence.queries.ReadAllQuery in project eclipselink by eclipse-ee4j.
the class UnitOfWorkConformWithOrderTest method test.
@Override
public void test() {
// Make a query an search Number greaterThan "00005"
ExpressionBuilder phone = new ExpressionBuilder();
Expression exp = phone.get("areaCode").equal(613);
ReadAllQuery query = new ReadAllQuery(PhoneNumber.class);
query.setSelectionCriteria(exp);
// set Conforming
query.conformResultsInUnitOfWork();
query.addOrdering(phone.get("owner").get("id").descending());
query.addOrdering(phone.get("type").descending());
UnitOfWork uow = getSession().acquireUnitOfWork();
Vector v = (Vector) uow.executeQuery(query);
Vector v2 = (Vector) uow.executeQuery(query);
if (!v.equals(v2)) {
throw new TestErrorException("Order not maintained when conforming:" + v + " != " + v2);
}
}
use of org.eclipse.persistence.queries.ReadAllQuery in project eclipselink by eclipse-ee4j.
the class ScrollableCursorJoinedAttributeTest method test.
@Override
public void test() {
if (getSession().getPlatform().isHANA() || getSession().getPlatform().isSQLServer()) {
throw new TestWarningException("ScrollableCursor is not supported on this platform");
}
getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
cursoredResults = new Vector();
ReadAllQuery cursoredQuery = new ReadAllQuery(Employee.class);
cursoredQuery.useScrollableCursor();
cursoredQuery.addJoinedAttribute(cursoredQuery.getExpressionBuilder().anyOfAllowingNone("phoneNumbers"));
cursoredQuery.addOrdering(cursoredQuery.getExpressionBuilder().get("id"));
try {
ScrollableCursor cursor = (ScrollableCursor) getSession().executeQuery(cursoredQuery);
while (cursor.hasNext()) {
Object result = cursor.next();
cursoredResults.add(result);
}
cursor.close();
} catch (Exception e) {
caughtException = e;
}
}
Aggregations