Search in sources :

Example 1 with DataPartitioningCallback

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);
    }
}
Also used : EntityManagerFactoryProvider.getConfigPropertyAsString(org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.getConfigPropertyAsString) DataPartitioningCallback(org.eclipse.persistence.platform.database.partitioning.DataPartitioningCallback) PartitioningPolicy(org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy) ValidationException(org.eclipse.persistence.exceptions.ValidationException) EclipseLinkException(org.eclipse.persistence.exceptions.EclipseLinkException) PrivilegedActionException(java.security.PrivilegedActionException) IOException(java.io.IOException) OptimisticLockException(jakarta.persistence.OptimisticLockException) DatabaseException(org.eclipse.persistence.exceptions.DatabaseException) DescriptorException(org.eclipse.persistence.exceptions.DescriptorException) RemoteException(java.rmi.RemoteException) IntegrityException(org.eclipse.persistence.exceptions.IntegrityException) EntityManagerSetupException(org.eclipse.persistence.exceptions.EntityManagerSetupException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ConversionException(org.eclipse.persistence.exceptions.ConversionException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) PersistenceException(jakarta.persistence.PersistenceException) MalformedURLException(java.net.MalformedURLException) PersistenceUnitLoadingException(org.eclipse.persistence.exceptions.PersistenceUnitLoadingException)

Aggregations

OptimisticLockException (jakarta.persistence.OptimisticLockException)1 PersistenceException (jakarta.persistence.PersistenceException)1 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 MalformedURLException (java.net.MalformedURLException)1 RemoteException (java.rmi.RemoteException)1 PrivilegedActionException (java.security.PrivilegedActionException)1 PartitioningPolicy (org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy)1 ConversionException (org.eclipse.persistence.exceptions.ConversionException)1 DatabaseException (org.eclipse.persistence.exceptions.DatabaseException)1 DescriptorException (org.eclipse.persistence.exceptions.DescriptorException)1 EclipseLinkException (org.eclipse.persistence.exceptions.EclipseLinkException)1 EntityManagerSetupException (org.eclipse.persistence.exceptions.EntityManagerSetupException)1 IntegrityException (org.eclipse.persistence.exceptions.IntegrityException)1 PersistenceUnitLoadingException (org.eclipse.persistence.exceptions.PersistenceUnitLoadingException)1 ValidationException (org.eclipse.persistence.exceptions.ValidationException)1 EntityManagerFactoryProvider.getConfigPropertyAsString (org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.getConfigPropertyAsString)1 DataPartitioningCallback (org.eclipse.persistence.platform.database.partitioning.DataPartitioningCallback)1