Map<String, String> targetIdColumnMapping = new HashMap<>(); return new JoinTable( oneToOneMapping.getRelationTable().getName(), null, idColumnMapping,
Map<String, String> targetIdColumnMapping = new HashMap<>(); return new JoinTable( oneToOneMapping.getRelationTable().getName(), null, idColumnMapping,
((OneToOneMapping) mapping).setRelationTable(updateTable(((OneToOneMapping) mapping).getRelationTable())); } else if (mapping.isDirectCollectionMapping()) { ((DirectCollectionMapping) mapping).setReferenceTable(updateTable(((DirectCollectionMapping) mapping).getReferenceTable()));
((OneToOneMapping) mapping).setRelationTable(updateTable(((OneToOneMapping) mapping).getRelationTable())); } else if (mapping.isDirectCollectionMapping()) { ((DirectCollectionMapping) mapping).setReferenceTable(updateTable(((DirectCollectionMapping) mapping).getReferenceTable()));
/** * INTERNAL: * This method is used to update the table per tenant descriptor with * a table per tenant schema. This includes any relation tables from * mappings. This will be done through the setting of a table qualifier on * the tables. * * This method should only be called at the start of a client session * lifecycle and should only be called once. */ protected void setTableSchemaPerTenant() { descriptor.setTableQualifier(contextTenant); // Any mapping with a relation table will need to be updated. for (DatabaseMapping mapping : descriptor.getMappings()) { if (mapping.isManyToManyMapping()) { ((ManyToManyMapping) mapping).getRelationTable().setTableQualifier(contextTenant); } else if (mapping.isOneToOneMapping() && ((OneToOneMapping) mapping).hasRelationTable()) { ((OneToOneMapping) mapping).getRelationTable().setTableQualifier(contextTenant); } else if (mapping.isDirectCollectionMapping()) { ((DirectCollectionMapping) mapping).getReferenceTable().setTableQualifier(contextTenant); } } }
/** * INTERNAL: * This method is used to update the table per tenant descriptor with * a table per tenant schema. This includes any relation tables from * mappings. This will be done through the setting of a table qualifier on * the tables. * * This method should only be called at the start of a client session * lifecycle and should only be called once. */ protected void setTableSchemaPerTenant() { descriptor.setTableQualifier(contextTenant); // Any mapping with a relation table will need to be updated. for (DatabaseMapping mapping : descriptor.getMappings()) { if (mapping.isManyToManyMapping()) { ((ManyToManyMapping) mapping).getRelationTable().setTableQualifier(contextTenant); } else if (mapping.isOneToOneMapping() && ((OneToOneMapping) mapping).hasRelationTable()) { ((OneToOneMapping) mapping).getRelationTable().setTableQualifier(contextTenant); } else if (mapping.isDirectCollectionMapping()) { ((DirectCollectionMapping) mapping).getReferenceTable().setTableQualifier(contextTenant); } } }
/** * Calculate the relation table for based on the various QueryKeyExpression * usages (join query keys, custom defined query keys, or query keys for * mappings). * * Called from {@link SQLSelectStatement#appendFromClauseForOuterJoin}. * * @return DatabaseTable */ public DatabaseTable getRelationTable() { if(getMapping() != null) { if(getMapping().isManyToManyMapping()) { return ((ManyToManyMapping)getMapping()).getRelationTable(); } else if(getMapping().isOneToOneMapping()) { return ((OneToOneMapping)getMapping()).getRelationTable(); } } else { if(getQueryKeyOrNull().isForeignReferenceQueryKey()) { return ((ForeignReferenceQueryKey)getQueryKeyOrNull()).getRelationTable(getDescriptor()); } } return null; } }
/** * Calculate the relation table for based on the various QueryKeyExpression * usages (join query keys, custom defined query keys, or query keys for * mappings). * * Called from {@link SQLSelectStatement#appendFromClauseForOuterJoin}. * * @return DatabaseTable */ @Override public DatabaseTable getRelationTable() { if(getMapping() != null) { if(getMapping().isManyToManyMapping()) { return ((ManyToManyMapping)getMapping()).getRelationTable(); } else if(getMapping().isOneToOneMapping()) { return ((OneToOneMapping)getMapping()).getRelationTable(); } } else { if(getQueryKeyOrNull().isForeignReferenceQueryKey()) { return ((ForeignReferenceQueryKey)getQueryKeyOrNull()).getRelationTable(getDescriptor()); } } return null; } }
/** * Calculate the relation table for based on the various QueryKeyExpression * usages (join query keys, custom defined query keys, or query keys for * mappings). * * Called from {@link SQLSelectStatement#appendFromClauseForOuterJoin}. * * @return DatabaseTable */ public DatabaseTable getRelationTable() { if(getMapping() != null) { if(getMapping().isManyToManyMapping()) { return ((ManyToManyMapping)getMapping()).getRelationTable(); } else if(getMapping().isOneToOneMapping()) { return ((OneToOneMapping)getMapping()).getRelationTable(); } } else { if(getQueryKeyOrNull().isForeignReferenceQueryKey()) { return ((ForeignReferenceQueryKey)getQueryKeyOrNull()).getRelationTable(getDescriptor()); } } return null; } }