Search in sources :

Example 1 with SQLCall

use of org.eclipse.persistence.queries.SQLCall in project eclipselink by eclipse-ee4j.

the class NamedQueryLinesIGetSQLStringIsNotNullTest method setup.

@Override
protected void setup() {
    getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
    descriptorToModify = project.getDescriptors().get(Employee.class);
    ReadObjectQuery testReadQuery = new ReadObjectQuery();
    SQLCall testCall = new SQLCall("testString");
    testReadQuery.setName("testQueryName");
    // setting the SQLCall on ReadObjectQuery
    testReadQuery.setCall(testCall);
    descriptorToModify.getQueryManager().setReadObjectQuery(testReadQuery);
    descriptorToModify.getQueryManager().addQuery(testReadQuery);
}
Also used : SQLCall(org.eclipse.persistence.queries.SQLCall) Employee(org.eclipse.persistence.testing.models.employee.domain.Employee) ReadObjectQuery(org.eclipse.persistence.queries.ReadObjectQuery)

Example 2 with SQLCall

use of org.eclipse.persistence.queries.SQLCall in project eclipselink by eclipse-ee4j.

the class QueryManagerHasDeleteQueryIsSQLCallQueryTest method setup.

@Override
protected void setup() {
    getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
    descriptorToModify = project.getDescriptors().get(Employee.class);
    DeleteObjectQuery testReadQuery = new DeleteObjectQuery();
    SQLCall testCall = new SQLCall();
    // setting the SQLCall on ReadObjectQuery
    testReadQuery.setCall(testCall);
    testReadQuery.setSQLString("testString");
    descriptorToModify.getQueryManager().setDeleteQuery(testReadQuery);
}
Also used : SQLCall(org.eclipse.persistence.queries.SQLCall) Employee(org.eclipse.persistence.testing.models.employee.domain.Employee) DeleteObjectQuery(org.eclipse.persistence.queries.DeleteObjectQuery)

Example 3 with SQLCall

use of org.eclipse.persistence.queries.SQLCall in project eclipselink by eclipse-ee4j.

the class QueryManagerHasReadObjectQueryIsSQLCallQueryTest method setup.

@Override
protected void setup() {
    getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
    project = new org.eclipse.persistence.testing.models.employee.relational.EmployeeProject();
    descriptorToModify = project.getDescriptors().get(Employee.class);
    ReadObjectQuery testReadQuery = new ReadObjectQuery();
    SQLCall testCall = new SQLCall();
    // setting the SQLCall on ReadObject
    testReadQuery.setCall(testCall);
    testReadQuery.setSQLString("testString");
    descriptorToModify.getQueryManager().setReadObjectQuery(testReadQuery);
    generator = new ProjectClassGenerator(project);
}
Also used : SQLCall(org.eclipse.persistence.queries.SQLCall) Employee(org.eclipse.persistence.testing.models.employee.domain.Employee) ReadObjectQuery(org.eclipse.persistence.queries.ReadObjectQuery) ProjectClassGenerator(org.eclipse.persistence.sessions.factories.ProjectClassGenerator)

Example 4 with SQLCall

use of org.eclipse.persistence.queries.SQLCall in project eclipselink by eclipse-ee4j.

the class EmployeeBasicTestModel method getReadAllTestSuite.

public static TestSuite getReadAllTestSuite() {
    TestSuite suite = getSRGReadAllTestSuite();
    // Add new tests here ...
    Expression orderBy = new ExpressionBuilder().get("firstName").ascending();
    Call call = new SQLCall("SELECT t0.VERSION, t1.EMP_ID, t0.L_NAME, t0.F_NAME, t1.SALARY, t0.EMP_ID, t0.GENDER, t0.END_DATE, t0.START_DATE, t0.MANAGER_ID, t0.ADDR_ID FROM EMPLOYEE t0, SALARY t1 WHERE t1.EMP_ID = t0.EMP_ID");
    suite.addTest(new ReadAllCallWithOrderingTest(org.eclipse.persistence.testing.models.employee.domain.Employee.class, 12, call, orderBy));
    return suite;
}
Also used : SQLCall(org.eclipse.persistence.queries.SQLCall) SQLCall(org.eclipse.persistence.queries.SQLCall) Call(org.eclipse.persistence.queries.Call) Expression(org.eclipse.persistence.expressions.Expression) ExpressionBuilder(org.eclipse.persistence.expressions.ExpressionBuilder)

Example 5 with SQLCall

use of org.eclipse.persistence.queries.SQLCall in project eclipselink by eclipse-ee4j.

the class EmployeeBasicTestModel method getSRGReadObjectTestSuite.

// SRG test set is maintained by QA only, do NOT add any new tests into it.
public static TestSuite getSRGReadObjectTestSuite() {
    TestSuite suite = new TestSuite();
    suite.setName("EmployeeReadObjectTestSuite");
    suite.setDescription("This suite test the reading of each object in the employee demo.");
    Class<Employee> employeeClass = org.eclipse.persistence.testing.models.employee.domain.Employee.class;
    Class<LargeProject> largeProjectClass = org.eclipse.persistence.testing.models.employee.domain.LargeProject.class;
    Class<SmallProject> smallProjectClass = org.eclipse.persistence.testing.models.employee.domain.SmallProject.class;
    PopulationManager manager = PopulationManager.getDefaultManager();
    suite.addTest(new ReadObjectTest(manager.getObject(employeeClass, "0001")));
    suite.addTest(new ReadObjectTest(manager.getObject(employeeClass, "0002")));
    suite.addTest(new ReadObjectTest(manager.getObject(employeeClass, "0003")));
    suite.addTest(new ReadObjectTest(manager.getObject(employeeClass, "0004")));
    suite.addTest(new ReadObjectTest(manager.getObject(employeeClass, "0005")));
    Employee employee = (Employee) manager.getObject(employeeClass, "0001");
    suite.addTest(new ReadObjectCallTest(employeeClass, new SQLCall("SELECT t0.VERSION, t1.EMP_ID, t0.L_NAME, t0.F_NAME, t1.SALARY, t0.EMP_ID, t0.GENDER, t0.END_DATE, t0.START_DATE, t0.MANAGER_ID, t0.END_TIME, t0.START_TIME, t0.ADDR_ID FROM EMPLOYEE t0, SALARY t1 WHERE t1.EMP_ID = t0.EMP_ID AND t0.F_NAME = '" + employee.getFirstName() + "' AND t0.L_NAME = '" + employee.getLastName() + "'")));
    employee = (Employee) manager.getObject(employeeClass, "0002");
    suite.addTest(new ReadObjectCallTest(employeeClass, new SQLCall("SELECT  t0.VERSION, t1.EMP_ID, t0.L_NAME, t0.F_NAME, t1.SALARY, t0.EMP_ID, t0.GENDER, t0.END_DATE, t0.START_DATE, t0.MANAGER_ID, t0.END_TIME, t0.START_TIME, t0.ADDR_ID FROM EMPLOYEE t0, SALARY t1 WHERE t1.EMP_ID = t0.EMP_ID AND t0.F_NAME = '" + employee.getFirstName() + "' AND t0.L_NAME = '" + employee.getLastName() + "'")));
    employee = (Employee) manager.getObject(employeeClass, "0003");
    suite.addTest(new ReadObjectCallTest(employeeClass, new SQLCall("SELECT  t0.VERSION, t1.EMP_ID, t0.L_NAME, t0.F_NAME, t1.SALARY, t0.EMP_ID, t0.GENDER, t0.END_DATE, t0.START_DATE, t0.MANAGER_ID, t0.END_TIME, t0.START_TIME, t0.ADDR_ID FROM EMPLOYEE t0, SALARY t1 WHERE t1.EMP_ID = t0.EMP_ID AND t0.F_NAME = '" + employee.getFirstName() + "' AND t0.L_NAME = '" + employee.getLastName() + "'")));
    org.eclipse.persistence.testing.models.employee.domain.Project project = (org.eclipse.persistence.testing.models.employee.domain.Project) manager.getObject(largeProjectClass, "0001");
    ReadObjectTest test = new ReadObjectTest(project);
    test.setQuery(new org.eclipse.persistence.queries.ReadObjectQuery(org.eclipse.persistence.testing.models.employee.domain.Project.class, new org.eclipse.persistence.expressions.ExpressionBuilder().get("id").equal(project.getId())));
    suite.addTest(test);
    suite.addTest(new ReadObjectTest(manager.getObject(smallProjectClass, "0001")));
    suite.addTest(new ReadObjectTest(manager.getObject(smallProjectClass, "0002")));
    suite.addTest(new ReadObjectTest(manager.getObject(smallProjectClass, "0003")));
    suite.addTest(new ReadObjectTest(manager.getObject(largeProjectClass, "0001")));
    suite.addTest(new ReadObjectTest(manager.getObject(largeProjectClass, "0002")));
    suite.addTest(new ReadObjectTest(manager.getObject(largeProjectClass, "0003")));
    return suite;
}
Also used : SQLCall(org.eclipse.persistence.queries.SQLCall) ExpressionBuilder(org.eclipse.persistence.expressions.ExpressionBuilder) PopulationManager(org.eclipse.persistence.tools.schemaframework.PopulationManager) org.eclipse.persistence.testing.models.employee.domain(org.eclipse.persistence.testing.models.employee.domain)

Aggregations

SQLCall (org.eclipse.persistence.queries.SQLCall)54 DatabaseField (org.eclipse.persistence.internal.helper.DatabaseField)12 ExpressionBuilder (org.eclipse.persistence.expressions.ExpressionBuilder)11 Expression (org.eclipse.persistence.expressions.Expression)9 Employee (org.eclipse.persistence.testing.models.employee.domain.Employee)9 Vector (java.util.Vector)8 ArrayList (java.util.ArrayList)6 DatabaseCall (org.eclipse.persistence.internal.databaseaccess.DatabaseCall)6 SQLSelectStatement (org.eclipse.persistence.internal.expressions.SQLSelectStatement)6 StoredProcedureCall (org.eclipse.persistence.queries.StoredProcedureCall)6 StringWriter (java.io.StringWriter)4 HashMap (java.util.HashMap)4 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)4 ObjectRelationalDatabaseField (org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField)4 DataModifyQuery (org.eclipse.persistence.queries.DataModifyQuery)4 PopulationManager (org.eclipse.persistence.tools.schemaframework.PopulationManager)4 CharArrayWriter (java.io.CharArrayWriter)3 Writer (java.io.Writer)3 IdentityHashMap (java.util.IdentityHashMap)3 Iterator (java.util.Iterator)3