/** * PUBLIC: * Specify the table for the class of objects the receiver describes. * This method is used if there is more than one table. */ public void addTable(DatabaseTable table) { getTables().add(table); }
/** * INTERNAL: * Check if descriptor has multiple tables */ public boolean hasMultipleTables() { return (getTables().size() > 1); }
/** * INTERNAL: * Return if this descriptor has more than one table. */ public boolean isMultipleTableDescriptor() { return getTables().size() > 1; }
/** * PUBLIC: * Returns the reference table. */ public DatabaseTable getReferenceTable(ClassDescriptor desc) { // TODO: This won't work for direct collection. // Should extract the target table from joinCriteria (if it's not null), // like ManyToManyQueryKey.getRelationTable does. return desc.getTables().firstElement(); }
/** * INTERNAL: * Check if descriptor has multiple tables */ public boolean hasMultipleTables() { return (getTables().size() > 1); }
/** * PUBLIC: * Returns the source table. */ public DatabaseTable getSourceTable() { // TODO: Should extract the target table from joinCriteria (if it's not null), // like ManyToManyQueryKey.getRelationTable does. return this.descriptor.getTables().firstElement(); }
/** * PUBLIC: * Returns the reference table. */ public DatabaseTable getReferenceTable(ClassDescriptor desc) { // TODO: This won't work for direct collection. // Should extract the target table from joinCriteria (if it's not null), // like ManyToManyQueryKey.getRelationTable does. return desc.getTables().firstElement(); }
/** * PUBLIC: * Returns the reference table. */ public DatabaseTable getReferenceTable(ClassDescriptor desc) { // TODO: This won't work for direct collection. // Should extract the target table from joinCriteria (if it's not null), // like ManyToManyQueryKey.getRelationTable does. return desc.getTables().firstElement(); }
/** * INTERNAL: * Check if descriptor has multiple tables */ public boolean hasMultipleTables() { return (getTables().size() > 1); }
/** * PUBLIC: * Return the table names. */ public Vector getTableNames() { Vector tableNames = new Vector(getTables().size()); for (Enumeration fieldsEnum = getTables().elements(); fieldsEnum.hasMoreElements();) { tableNames.addElement(((DatabaseTable)fieldsEnum.nextElement()).getQualifiedName()); } return tableNames; }
/** * INTERNAL: * It is responsible for initializing the policy; */ public void initialize(AbstractSession session) { // If the version field is not in the primary table, then they cannot be batched together. if (this.descriptor.getTables().size() > 0) { this.descriptor.setHasMultipleTableConstraintDependecy(true); } }
/** * INTERNAL: * all tables for reference class plus childrenTables */ public Vector getAllTables() { if (allTables == null) { return this.getDescriptor().getTables(); } else { return allTables; } }
/** * PUBLIC: Set the table Qualifier for this descriptor. This table creator will be used for * all tables in this descriptor */ public void setTableQualifier(String tableQualifier) { for (Enumeration enumtr = getTables().elements(); enumtr.hasMoreElements();) { DatabaseTable table = (DatabaseTable)enumtr.nextElement(); table.setTableQualifier(tableQualifier); } }
/** * INTERNAL: * It is responsible for initializing the policy; */ public void initialize(AbstractSession session) { // If the version field is not in the primary table, then they cannot be batched together. if (this.descriptor.getTables().size() > 0) { this.descriptor.setHasMultipleTableConstraintDependecy(true); } }
public NestedTable(QueryKeyExpression queryKeyExpression) { super(); this.queryKeyExpression = queryKeyExpression; setName((queryKeyExpression.getMapping().getDescriptor().getTables().firstElement()).getName()); tableQualifier = (queryKeyExpression.getMapping().getDescriptor().getTables().firstElement()).getQualifiedName(); }
/** * Build and return the expression to use as the where clause to delete an object. * The row is passed to allow the version number to be extracted from it. * If called with usesOptimisticLocking==true the caller should make sure that descriptor uses optimistic locking policy. */ public Expression buildDeleteExpression(DatabaseTable table, AbstractRecord row, boolean usesOptimisticLocking) { if (usesOptimisticLocking && (this.descriptor.getTables().firstElement().equals(table))) { return this.descriptor.getOptimisticLockingPolicy().buildDeleteExpression(table, primaryKeyExpression, row); } else { return buildPrimaryKeyExpression(table); } }
public static DescriptorException multipleTableInsertOrderMismatch(ClassDescriptor aDescriptor) { Object[] args = { aDescriptor.getMultipleTableInsertOrder(), aDescriptor.getTables(), CR }; DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, MULTIPLE_TABLE_INSERT_ORDER_MISMATCH, args)); descriptorException.setErrorCode(MULTIPLE_TABLE_INSERT_ORDER_MISMATCH); descriptorException.setDescriptor(aDescriptor); return descriptorException; }
public static DescriptorException multipleTableInsertOrderMismatch(ClassDescriptor aDescriptor) { Object[] args = { aDescriptor.getMultipleTableInsertOrder(), aDescriptor.getTables(), CR }; DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, MULTIPLE_TABLE_INSERT_ORDER_MISMATCH, args)); descriptorException.setErrorCode(MULTIPLE_TABLE_INSERT_ORDER_MISMATCH); descriptorException.setDescriptor(aDescriptor); return descriptorException; }