/** * INTERNAL: */ @Override public boolean isOwned(){ return this.hasRelationTable() && ! this.isReadOnly; }
/** * INTERNAL: */ @Override public boolean isOwned(){ return this.hasRelationTable() && ! this.isReadOnly; }
/** * INTERNAL: */ public boolean isOwned(){ return this.hasRelationTable() && ! this.isReadOnly; }
@Override public boolean isForeignJoinColumn(EntityType<?> ownerType, String attributeName) { ManagedTypeImpl<?> managedType = (ManagedTypeImpl<?>) ownerType; String[] parts = attributeName.split("\\."); DatabaseMapping mapping = managedType.getDescriptor().getMappingForAttributeName(parts[0]); for (int i = 1; i < parts.length; i++) { mapping = mapping.getReferenceDescriptor().getMappingForAttributeName(parts[i]); } if (mapping instanceof OneToOneMapping) { return ((OneToOneMapping) mapping).hasRelationTable(); } return false; }
@Override public boolean isForeignJoinColumn(EntityType<?> ownerType, String attributeName) { ManagedTypeImpl<?> managedType = (ManagedTypeImpl<?>) ownerType; String[] parts = attributeName.split("\\."); DatabaseMapping mapping = managedType.getDescriptor().getMappingForAttributeName(parts[0]); for (int i = 1; i < parts.length; i++) { mapping = mapping.getReferenceDescriptor().getMappingForAttributeName(parts[i]); } if (mapping instanceof OneToOneMapping) { return ((OneToOneMapping) mapping).hasRelationTable(); } return false; }
if (mapping instanceof OneToOneMapping) { OneToOneMapping oneToOneMapping = (OneToOneMapping) mapping; if (oneToOneMapping.hasRelationTable()) { Map<String, String> idColumnMapping = new HashMap<>(); Map<String, String> keyMapping = null;
if (mapping instanceof OneToOneMapping) { OneToOneMapping oneToOneMapping = (OneToOneMapping) mapping; if (oneToOneMapping.hasRelationTable()) { Map<String, String> idColumnMapping = new HashMap<>(); Map<String, String> keyMapping = null;
((ManyToManyMapping) mapping).setRelationTable(updateTable(((ManyToManyMapping) mapping).getRelationTable())); } else if (mapping.isOneToOneMapping() && ((OneToOneMapping) mapping).hasRelationTable()) { ((OneToOneMapping) mapping).setRelationTable(updateTable(((OneToOneMapping) mapping).getRelationTable())); } else if (mapping.isDirectCollectionMapping()) {
((ManyToManyMapping) mapping).setRelationTable(updateTable(((ManyToManyMapping) mapping).getRelationTable())); } else if (mapping.isOneToOneMapping() && ((OneToOneMapping) mapping).hasRelationTable()) { ((OneToOneMapping) mapping).setRelationTable(updateTable(((OneToOneMapping) mapping).getRelationTable())); } else if (mapping.isDirectCollectionMapping()) {
/** * 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); } } }