public Vector getAttributeFromAll(String attributeName, Vector objects) { ClassDescriptor descriptor = getSession().getClassDescriptor(getReferenceClass()); DirectToFieldMapping mapping = (DirectToFieldMapping) descriptor.getMappingForAttributeName(attributeName); Vector attributes = new Vector(); Object currentObject; for (int i = 0; i < objects.size(); i++) { currentObject = objects.elementAt(i); if (currentObject.getClass() == ReportQueryResult.class) { attributes.addElement(((ReportQueryResult) currentObject).get(attributeName)); } else { attributes.addElement(mapping.getAttributeValueFromObject(currentObject)); } } return attributes; }
public ReadAllBindAllParametersTest() { v = new Vector(2); v.addElement(new BigDecimal(1001)); v.addElement(new BigDecimal(1002)); setName("ReadAllBindAllParametersTest"); setDescription( "Tests all combinations of shouldBindAllParameters attributes on Session and Query"); }
public void addDescriptors(DatabaseSession session) { Vector descriptors = new Vector(); descriptors.addElement(LockInCache.descriptor()); descriptors.addElement(LockInObject.descriptor()); descriptors.addElement(TimestampInCache.descriptor()); descriptors.addElement(TimestampInObject.descriptor()); descriptors.addElement(TimestampVersion.descriptor()); descriptors.addElement(TimestampInAggregateObject.descriptor()); // descriptors.addElement(ObjectVersion.descriptor()); descriptors.addElement(LockInAggregateObject.descriptor()); // descriptors.addElement(ChangedRow.descriptor()); (session).addDescriptors(descriptors); (session).addDescriptors(new RockBandProject()); (session).addDescriptors(new AnimalProject()); }
public void test() { Vector sessions = new Vector(); try { for (int i = 0; i < stressLevel; i++) { Session session = new Project(getSession().getDatasourceLogin().clone()).createDatabaseSession(); ((DatabaseSession) session).login(); sessions.addElement(session); } getSession().readObject(Address.class); } finally { for (Enumeration sessionEnum = sessions.elements(); sessionEnum.hasMoreElements(); ) { ((DatabaseSession) sessionEnum.nextElement()).logout(); } } getSession().readObject(Address.class); }
public void addUnsupportedPlatform(Class platform) { if (unsupportedPlatforms == null) { unsupportedPlatforms = new Vector(); } unsupportedPlatforms.addElement(platform); }
public void addSupportedPlatform(Class platform) { if (supportedPlatforms == null) { supportedPlatforms = new Vector(); } supportedPlatforms.addElement(platform); }
public void test() { ReadAllQuery query = new ReadAllQuery(); ScrollableCursor cursor = null; try { query.setReferenceClass(Employee.class); if (TYPE_SCROLL_INSENSITIVE_isSupported && CONCUR_UPDATABLE_isSupported) { query.useScrollableCursor(2); } else { ScrollableCursorPolicy policy = new ScrollableCursorPolicy(); if (!TYPE_SCROLL_INSENSITIVE_isSupported) { policy.setResultSetType(ScrollableCursorPolicy.TYPE_SCROLL_SENSITIVE); } if (!CONCUR_UPDATABLE_isSupported) { policy.setResultSetConcurrency(ScrollableCursorPolicy.CONCUR_READ_ONLY); } policy.setPageSize(2); query.useScrollableCursor(policy); } // if (configuration != null) { ExpressionBuilder builder = new ExpressionBuilder(); Expression exp = builder.get("salary").greaterThan(50000); query.setSelectionCriteria(exp); query.conformResultsInUnitOfWork(); } cursor = (ScrollableCursor) getSession().executeQuery(query); try { // test to see if we can iterate through a list and then iterate // in reverse through the same list. int totalItems = 0; while (cursor.hasNext()) { readWithNext.addElement(cursor.next()); totalItems++; } while (cursor.hasPrevious()) { readWithPrevious.addElement(cursor.previous()); totalItems--; } cursorSuccess = (totalItems == 0); int size = readWithPrevious.size(); for (int i = 0; i < readWithNext.size(); i++) { cursorSuccess = (cursorSuccess && (readWithNext.elementAt(i) == readWithPrevious.elementAt((size - 1) - i))); } } catch (org.eclipse.persistence.exceptions.QueryException ex) { caughtException = ex; } } finally { if (cursor != null) { cursor.close(); } } }