use of org.eclipse.persistence.platform.database.partitioning.DataPartitioningCallback in project eclipselink by eclipse-ee4j.
the class EntityManagerSetupImpl method updatePartitioning.
/**
* Checks for partitioning properties.
*/
protected void updatePartitioning(Map m, ClassLoader loader) {
// Partitioning
String partitioning = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.PARTITIONING, m, this.session);
if (partitioning != null) {
PartitioningPolicy partitioningPolicy = this.session.getProject().getPartitioningPolicy(partitioning);
if (partitioningPolicy == null) {
throw DescriptorException.missingPartitioningPolicy(partitioning, null, null);
}
this.session.setPartitioningPolicy(partitioningPolicy);
}
String callbackClassName = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.PARTITIONING_CALLBACK, m, this.session);
if (callbackClassName != null) {
DataPartitioningCallback callback = null;
try {
Class<? extends DataPartitioningCallback> cls = findClassForProperty(callbackClassName, PersistenceUnitProperties.PARTITIONING_CALLBACK, loader);
Constructor<? extends DataPartitioningCallback> constructor = cls.getConstructor();
callback = constructor.newInstance();
} catch (Exception exception) {
throw EntityManagerSetupException.failedToInstantiateProperty(callbackClassName, PersistenceUnitProperties.PARTITIONING_CALLBACK, exception);
}
this.session.getLogin().setPartitioningCallback(callback);
}
}
Aggregations