use of org.eclipse.persistence.internal.jpa.metadata.columns.TenantDiscriminatorColumnMetadata in project eclipselink by eclipse-ee4j.
the class XMLPersistenceUnitDefaults method hashCode.
@Override
public int hashCode() {
AccessMethodsMetadata accessMethods = getAccessMethods();
Boolean cascadePersist = getCascadePersist();
Boolean delimitedIdentifiers = getDelimitedIdentifiers();
List<EntityListenerMetadata> entityListeners = getEntityListeners();
List<TenantDiscriminatorColumnMetadata> tenantDiscriminatorColumns = getTenantDiscriminatorColumns();
String access = getAccess();
String catalog = getCatalog();
String schema = getSchema();
int result = accessMethods != null ? accessMethods.hashCode() : 0;
result = 31 * result + (cascadePersist != null ? cascadePersist.hashCode() : 0);
result = 31 * result + (delimitedIdentifiers != null ? delimitedIdentifiers.hashCode() : 0);
result = 31 * result + (entityListeners != null ? entityListeners.hashCode() : 0);
result = 31 * result + (tenantDiscriminatorColumns != null ? tenantDiscriminatorColumns.hashCode() : 0);
result = 31 * result + (access != null ? access.hashCode() : 0);
result = 31 * result + (catalog != null ? catalog.hashCode() : 0);
result = 31 * result + (schema != null ? schema.hashCode() : 0);
return result;
}
use of org.eclipse.persistence.internal.jpa.metadata.columns.TenantDiscriminatorColumnMetadata in project eclipselink by eclipse-ee4j.
the class MultitenantMetadata method processTenantDiscriminators.
/**
* INTERNAL:
* Process the tenant discriminator metadata.
*/
protected void processTenantDiscriminators(MetadataDescriptor descriptor, SingleTableMultitenantPolicy policy) {
// Check for tenant discriminator columns from a parent class.
if (descriptor.isInheritanceSubclass()) {
// If we are an inheritance subclass, our parent will have been
// processed and we only care about discriminator columns if we are
// part of a TABLE_PER_CLASS setting.
EntityAccessor parentAccessor = descriptor.getInheritanceRootDescriptor().getEntityAccessor();
if (!parentAccessor.getInheritance().usesTablePerClassStrategy()) {
// user has not specified discriminator columns on the subclass.
if (!m_tenantDiscriminatorColumns.isEmpty()) {
getLogger().logWarningMessage(MetadataLogger.IGNORE_INHERITANCE_TENANT_DISCRIMINATOR_COLUMN, descriptor.getJavaClass());
}
return;
}
}
// defaults level if none are associated with this multitenant metadata.
if (m_tenantDiscriminatorColumns.isEmpty()) {
m_tenantDiscriminatorColumns = descriptor.getDefaultTenantDiscriminatorColumns();
// If we still don't have a tenant discriminator, default one.
if (m_tenantDiscriminatorColumns.isEmpty()) {
m_tenantDiscriminatorColumns.add(new TenantDiscriminatorColumnMetadata(descriptor.getClassAccessor()));
} else {
// context.
for (TenantDiscriminatorColumnMetadata tenantDiscriminator : m_tenantDiscriminatorColumns) {
tenantDiscriminator.setAccessibleObject(getAccessibleObject());
tenantDiscriminator.setProject(getProject());
}
}
}
// Process the tenant discriminators now.
for (TenantDiscriminatorColumnMetadata tenantDiscriminator : m_tenantDiscriminatorColumns) {
tenantDiscriminator.process(descriptor, policy);
}
}
Aggregations