/** * PUBLIC: * Read all of the instances of the class from the database. * This operation can be customized through using a ReadAllQuery, * or through also passing in a selection criteria. * * @see ReadAllQuery * @see #readAllObjects(Class, Expression) */ public Vector readAllObjects(Class domainClass) throws DatabaseException { ReadAllQuery query = new ReadAllQuery(); query.setIsExecutionClone(true); query.setReferenceClass(domainClass); return (Vector)executeQuery(query); }
/** * PUBLIC: * Read all of the instances of the class from the database. * This operation can be customized through using a ReadAllQuery, * or through also passing in a selection criteria. * * @see ReadAllQuery * @see #readAllObjects(Class, Expression) */ public Vector readAllObjects(Class domainClass) throws DatabaseException { ReadAllQuery query = new ReadAllQuery(); query.setIsExecutionClone(true); query.setReferenceClass(domainClass); return (Vector)executeQuery(query); }
/** * PUBLIC: * Read all of the instances of the class from the database. * This operation can be customized through using a ReadAllQuery, * or through also passing in a selection criteria. * * @see ReadAllQuery * @see #readAllObjects(Class, Expression) */ @Override public Vector readAllObjects(Class domainClass) throws DatabaseException { ReadAllQuery query = new ReadAllQuery(); query.setIsExecutionClone(true); query.setReferenceClass(domainClass); return (Vector)executeQuery(query); }
/** * INTERNAL: * Certain key mappings favor different types of selection query. Return the appropriate * type of selectionQuery * @return */ @Override public ReadQuery buildSelectionQueryForDirectCollectionKeyMapping(ContainerPolicy containerPolicy){ ReadAllQuery query = new ReadAllQuery(); query.setReferenceClass(referenceClass); query.setDescriptor(getReferenceDescriptor()); query.setContainerPolicy(containerPolicy); return query; }
/** * INTERNAL: * Certain key mappings favor different types of selection query. Return the appropriate * type of selectionQuery * @return */ @Override public ReadQuery buildSelectionQueryForDirectCollectionKeyMapping(ContainerPolicy containerPolicy){ ReadAllQuery query = new ReadAllQuery(); query.setReferenceClass(referenceClass); query.setDescriptor(getReferenceDescriptor()); query.setContainerPolicy(containerPolicy); return query; }
/** * INTERNAL: * Certain key mappings favor different types of selection query. Return the appropriate * type of selectionQuery * @return */ public ReadQuery buildSelectionQueryForDirectCollectionKeyMapping(ContainerPolicy containerPolicy){ ReadAllQuery query = new ReadAllQuery(); query.setReferenceClass(referenceClass); query.setDescriptor(getReferenceDescriptor()); query.setContainerPolicy(containerPolicy); return query; }
/** * PUBLIC: * Read all of the instances of the class from the database matching the given expression. * This operation can be customized through using a ReadAllQuery. * * @see ReadAllQuery */ public Vector readAllObjects(Class domainClass, Expression expression) throws DatabaseException { ReadAllQuery query = new ReadAllQuery(); query.setReferenceClass(domainClass); query.setSelectionCriteria(expression); query.setIsExecutionClone(true); return (Vector)executeQuery(query); }
/** * PUBLIC: * Read all the instances of the class from the database returned through execution the Call string. * The Call can be an SQLCall or JPQLCall. * * example: session.readAllObjects(Employee.class, new SQLCall("SELECT * FROM EMPLOYEE")); * @see Call */ public Vector readAllObjects(Class referenceClass, Call aCall) throws DatabaseException { ReadAllQuery raq = new ReadAllQuery(); raq.setReferenceClass(referenceClass); raq.setCall(aCall); raq.setIsExecutionClone(true); return (Vector)executeQuery(raq); }
/** * PUBLIC: * Read all of the instances of the class from the database matching the given expression. * This operation can be customized through using a ReadAllQuery. * * @see ReadAllQuery */ public Vector readAllObjects(Class domainClass, Expression expression) throws DatabaseException { ReadAllQuery query = new ReadAllQuery(); query.setReferenceClass(domainClass); query.setSelectionCriteria(expression); query.setIsExecutionClone(true); return (Vector)executeQuery(query); }
/** * PUBLIC: * Read all the instances of the class from the database returned through execution the Call string. * The Call can be an SQLCall or JPQLCall. * * example: session.readAllObjects(Employee.class, new SQLCall("SELECT * FROM EMPLOYEE")); * @see Call */ public Vector readAllObjects(Class referenceClass, Call aCall) throws DatabaseException { ReadAllQuery raq = new ReadAllQuery(); raq.setReferenceClass(referenceClass); raq.setCall(aCall); raq.setIsExecutionClone(true); return (Vector)executeQuery(raq); }
/** * PUBLIC: * Read all of the instances of the class from the database matching the given expression. * This operation can be customized through using a ReadAllQuery. * * @see ReadAllQuery */ @Override public Vector readAllObjects(Class domainClass, Expression expression) throws DatabaseException { ReadAllQuery query = new ReadAllQuery(); query.setReferenceClass(domainClass); query.setSelectionCriteria(expression); query.setIsExecutionClone(true); return (Vector)executeQuery(query); }
/** * PUBLIC: * Read all the instances of the class from the database returned through execution the Call string. * The Call can be an SQLCall or JPQLCall. * * example: session.readAllObjects(Employee.class, new SQLCall("SELECT * FROM EMPLOYEE")); * @see Call */ @Override public Vector readAllObjects(Class referenceClass, Call aCall) throws DatabaseException { ReadAllQuery raq = new ReadAllQuery(); raq.setReferenceClass(referenceClass); raq.setCall(aCall); raq.setIsExecutionClone(true); return (Vector)executeQuery(raq); }
/** * PUBLIC: * Read all of the instances of the class from the database return through execution the SQL string. * The SQL string must be a valid SQL select statement or selecting stored procedure call. * This operation can be customized through using a ReadAllQuery. * Warning: Allowing an unverified SQL string to be passed into this * method makes your application vulnerable to SQL injection attacks. * * @see ReadAllQuery */ public Vector readAllObjects(Class domainClass, String sqlString) throws DatabaseException { ReadAllQuery query = new ReadAllQuery(); query.setReferenceClass(domainClass); query.setSQLString(sqlString); query.setIsExecutionClone(true); return (Vector)executeQuery(query); }
/** * INTERNAL: Generates the read all stored procedure for this descriptor */ protected StoredProcedureDefinition generateReadAllStoredProcedure(ClassDescriptor descriptor) { ReadAllQuery readAllQuery = new ReadAllQuery(); readAllQuery.setDescriptor(descriptor); readAllQuery.setReferenceClass(descriptor.getJavaClass()); return generateObjectStoredProcedure(readAllQuery, descriptor.getPrimaryKeyFields(), "RALL_"); }
/** * INTERNAL: Generates the read all stored procedure for this descriptor */ protected StoredProcedureDefinition generateReadAllStoredProcedure(ClassDescriptor descriptor) { ReadAllQuery readAllQuery = new ReadAllQuery(); readAllQuery.setDescriptor(descriptor); readAllQuery.setReferenceClass(descriptor.getJavaClass()); return generateObjectStoredProcedure(readAllQuery, descriptor.getPrimaryKeyFields(), "RALL_"); }
/** * INTERNAL: Generates the read all stored procedure for this descriptor */ protected StoredProcedureDefinition generateReadAllStoredProcedure(ClassDescriptor descriptor) { ReadAllQuery readAllQuery = new ReadAllQuery(); readAllQuery.setDescriptor(descriptor); readAllQuery.setReferenceClass(descriptor.getJavaClass()); return generateObjectStoredProcedure(readAllQuery, descriptor.getPrimaryKeyFields(), "RALL_"); }
ReadAllQuery query = new ReadAllQuery(); query.setReferenceClass(Employee.class); query.setSelectionCriteria(new ExpressionBuilder.get("id").greaterThan(100)); // Set the JDBC fetch size query.setFetchSize(50); // Configure the query to return results as a ScrollableCursor query.useScrollableCursor(); // Execute the query ScrollableCursor cursor = (ScrollableCursor) session.executeQuery(query); // Iterate over the results while (cursor.hasNext()) { System.out.println(cursor.next().toString()); } cursor.close();
/** * INTERNAL: Generates the read all stored procedure for this mapping */ protected StoredProcedureDefinition generateOneToManyMappingReadProcedure(OneToManyMapping mapping) { ClassDescriptor targetDescriptor = mapping.getReferenceDescriptor(); ReadAllQuery readAllQuery = new ReadAllQuery(); readAllQuery.setDescriptor(targetDescriptor); readAllQuery.setReferenceClass(targetDescriptor.getJavaClass()); readAllQuery.setSelectionCriteria(mapping.getSelectionCriteria()); return generateOneToManyMappingProcedures(mapping, readAllQuery, mapping.getTargetForeignKeyToSourceKeys(), "R_1M_"); }
/** * INTERNAL: Generates the read all stored procedure for this mapping */ protected StoredProcedureDefinition generateOneToManyMappingReadProcedure(OneToManyMapping mapping) { ClassDescriptor targetDescriptor = mapping.getReferenceDescriptor(); ReadAllQuery readAllQuery = new ReadAllQuery(); readAllQuery.setDescriptor(targetDescriptor); readAllQuery.setReferenceClass(targetDescriptor.getJavaClass()); readAllQuery.setSelectionCriteria(mapping.getSelectionCriteria()); return generateOneToManyMappingProcedures(mapping, readAllQuery, mapping.getTargetForeignKeyToSourceKeys(), "R_1M_"); }
/** * INTERNAL: Generates the read all stored procedure for this mapping */ protected StoredProcedureDefinition generateOneToManyMappingReadProcedure(OneToManyMapping mapping) { ClassDescriptor targetDescriptor = mapping.getReferenceDescriptor(); ReadAllQuery readAllQuery = new ReadAllQuery(); readAllQuery.setDescriptor(targetDescriptor); readAllQuery.setReferenceClass(targetDescriptor.getJavaClass()); readAllQuery.setSelectionCriteria(mapping.getSelectionCriteria()); return generateOneToManyMappingProcedures(mapping, readAllQuery, mapping.getTargetForeignKeyToSourceKeys(), "R_1M_"); }