http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
index d4bce14..aa38d77 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
@@ -18,7 +18,6 @@
  */
 package org.apache.syncope.core.persistence.jpa.dao;
 
-import java.util.Collections;
 import java.util.List;
 import javax.persistence.TypedQuery;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
@@ -27,7 +26,6 @@ import 
org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
 import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
 import org.apache.syncope.core.persistence.api.entity.AnyUtils;
 import org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory;
-import org.apache.syncope.core.persistence.api.entity.Attr;
 import org.apache.syncope.core.persistence.api.entity.VirSchema;
 import org.apache.syncope.core.persistence.api.entity.resource.Provision;
 import org.apache.syncope.core.persistence.jpa.entity.JPAAnyUtilsFactory;
@@ -78,11 +76,6 @@ public class JPAVirSchemaDAO extends AbstractDAO<VirSchema, 
String> implements V
     }
 
     @Override
-    public <T extends Attr<VirSchema, ?>> List<T> findAttrs(final VirSchema 
schema, final Class<T> reference) {
-        return Collections.emptyList();
-    }
-
-    @Override
     public VirSchema save(final VirSchema virSchema) {
         return entityManager().merge(virSchema);
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAny.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAny.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAny.java
index 041c54f..ba02c45 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAny.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAny.java
@@ -21,7 +21,6 @@ package org.apache.syncope.core.persistence.jpa.entity;
 import 
org.apache.syncope.core.persistence.jpa.entity.resource.JPAExternalResource;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import javax.persistence.Column;
@@ -34,23 +33,19 @@ import org.apache.commons.collections4.Predicate;
 import org.apache.commons.collections4.Transformer;
 import org.apache.syncope.core.persistence.api.entity.Any;
 import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
-import org.apache.syncope.core.persistence.api.entity.DerAttr;
 import org.apache.syncope.core.persistence.api.entity.DerSchema;
 import org.apache.syncope.core.persistence.api.entity.PlainAttr;
 import org.apache.syncope.core.persistence.api.entity.PlainSchema;
 import org.apache.syncope.core.persistence.api.entity.Realm;
 import org.apache.syncope.core.persistence.api.entity.VirSchema;
-import org.apache.syncope.core.persistence.api.entity.anyobject.AMembership;
-import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
-import org.apache.syncope.core.persistence.api.entity.group.TypeExtension;
 import 
org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.user.UMembership;
-import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.apache.syncope.core.persistence.jpa.validation.entity.AnyCheck;
 
+@AnyCheck
 @MappedSuperclass
-public abstract class AbstractAny<P extends PlainAttr<?>, D extends DerAttr<?>>
+public abstract class AbstractAny<P extends PlainAttr<?>>
         extends AbstractAnnotatedEntity<Long>
-        implements Any<P, D> {
+        implements Any<P> {
 
     private static final long serialVersionUID = -2666540708092702810L;
 
@@ -114,18 +109,6 @@ public abstract class AbstractAny<P extends PlainAttr<?>, 
D extends DerAttr<?>>
         });
     }
 
-    @Override
-    public D getDerAttr(final String derSchemaName) {
-        return CollectionUtils.find(getDerAttrs(), new Predicate<D>() {
-
-            @Override
-            public boolean evaluate(final D derAttr) {
-                return derAttr != null && derAttr.getSchema() != null
-                        && derSchemaName.equals(derAttr.getSchema().getKey());
-            }
-        });
-    }
-
     protected abstract List<JPAExternalResource> internalGetResources();
 
     @Override
@@ -159,70 +142,8 @@ public abstract class AbstractAny<P extends PlainAttr<?>, 
D extends DerAttr<?>>
     private void populateAllowedSchemas(final Collection<? extends 
AnyTypeClass> anyTypeClasses) {
         for (AnyTypeClass anyTypeClass : anyTypeClasses) {
             allowedPlainSchemas.addAll(anyTypeClass.getPlainSchemas());
-        }
-
-        for (AnyTypeClass anyTypeClass : anyTypeClasses) {
             allowedDerSchemas.addAll(anyTypeClass.getDerSchemas());
-        }
-
-        for (AnyTypeClass anyTypeClass : anyTypeClasses) {
             allowedVirSchemas.addAll(anyTypeClass.getVirSchemas());
         }
     }
-
-    private void populateAllowedSchemas() {
-        synchronized (this) {
-            if (allowedPlainSchemas == null) {
-                allowedPlainSchemas = new HashSet<>();
-            } else {
-                allowedPlainSchemas.clear();
-            }
-            if (allowedDerSchemas == null) {
-                allowedDerSchemas = new HashSet<>();
-            } else {
-                allowedDerSchemas.clear();
-            }
-            if (allowedVirSchemas == null) {
-                allowedVirSchemas = new HashSet<>();
-            } else {
-                allowedVirSchemas.clear();
-            }
-
-            populateAllowedSchemas(getType().getClasses());
-            populateAllowedSchemas(getAuxClasses());
-            if (this instanceof User) {
-                for (UMembership memb : ((User) this).getMemberships()) {
-                    for (TypeExtension typeExtension : 
memb.getRightEnd().getTypeExtensions()) {
-                        populateAllowedSchemas(typeExtension.getAuxClasses());
-                    }
-                }
-            }
-            if (this instanceof AnyObject) {
-                for (AMembership memb : ((AnyObject) this).getMemberships()) {
-                    for (TypeExtension typeExtension : 
memb.getRightEnd().getTypeExtensions()) {
-                        populateAllowedSchemas(typeExtension.getAuxClasses());
-                    }
-                }
-            }
-        }
-    }
-
-    @Override
-    public Set<PlainSchema> getAllowedPlainSchemas() {
-        populateAllowedSchemas();
-        return allowedPlainSchemas;
-    }
-
-    @Override
-    public Set<DerSchema> getAllowedDerSchemas() {
-        populateAllowedSchemas();
-        return allowedDerSchemas;
-    }
-
-    @Override
-    public Set<VirSchema> getAllowedVirSchemas() {
-        populateAllowedSchemas();
-        return allowedVirSchemas;
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAttr.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAttr.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAttr.java
deleted file mode 100644
index 694b18f..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractAttr.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.persistence.jpa.entity;
-
-import java.util.Collections;
-import java.util.Set;
-import org.apache.syncope.core.persistence.api.dao.UnallowedSchemaException;
-import org.apache.syncope.core.persistence.api.entity.Any;
-import org.apache.syncope.core.persistence.api.entity.Attr;
-import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
-import org.apache.syncope.core.persistence.api.entity.Schema;
-import org.apache.syncope.core.persistence.api.entity.VirSchema;
-
-public abstract class AbstractAttr<S extends Schema, O extends Any<?, ?>>
-        extends AbstractEntity<Long> implements Attr<S, O> {
-
-    private static final long serialVersionUID = -7722134717360731874L;
-
-    @SuppressWarnings("unchecked")
-    private Set<S> getAllowedSchemas(final O any) {
-        Set<S> result = Collections.emptySet();
-
-        if (getSchema() instanceof PlainSchema) {
-            result = (Set<S>) any.getAllowedPlainSchemas();
-        } else if (getSchema() instanceof DerSchema) {
-            result = (Set<S>) any.getAllowedDerSchemas();
-        } else if (getSchema() instanceof VirSchema) {
-            result = (Set<S>) any.getAllowedVirSchemas();
-        }
-
-        return result;
-    }
-
-    protected void checkSchema(final S schema) {
-        if (schema == null || getOwner() == null) {
-            throw new IllegalStateException("First set owner then schema and 
finally add values");
-        }
-
-        if (!getAllowedSchemas(getOwner()).contains(schema)) {
-            throw new UnallowedSchemaException(schema.getKey());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDerAttr.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDerAttr.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDerAttr.java
deleted file mode 100644
index 59f390d..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDerAttr.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.persistence.jpa.entity;
-
-import java.util.Collection;
-import javax.persistence.Column;
-import javax.persistence.FetchType;
-import javax.persistence.ManyToOne;
-import javax.persistence.MappedSuperclass;
-import org.apache.syncope.core.persistence.api.entity.DerAttr;
-import org.apache.syncope.core.persistence.api.entity.PlainAttr;
-import org.apache.syncope.core.misc.jexl.JexlUtils;
-import org.apache.syncope.core.persistence.api.entity.Any;
-import org.apache.syncope.core.persistence.api.entity.DerSchema;
-
-@MappedSuperclass
-public abstract class AbstractDerAttr<O extends Any<?, ?>>
-        extends AbstractAttr<DerSchema, O> implements DerAttr<O> {
-
-    private static final long serialVersionUID = 4740924251090424771L;
-
-    @ManyToOne(fetch = FetchType.EAGER)
-    @Column(name = "schema_name")
-    private JPADerSchema schema;
-
-    @Override
-    public DerSchema getSchema() {
-        return schema;
-    }
-
-    @Override
-    public void setSchema(final DerSchema schema) {
-        checkType(schema, JPADerSchema.class);
-        this.schema = (JPADerSchema) schema;
-        checkSchema(this.schema);
-    }
-
-    /**
-     * @param attributes the set of attributes against which evaluate this 
derived attribute
-     * @return the value of this derived attribute
-     */
-    @Override
-    public String getValue(final Collection<? extends PlainAttr<?>> 
attributes) {
-        return JexlUtils.evaluate(getSchema().getExpression(), getOwner(), 
attributes);
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDynMembership.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDynMembership.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDynMembership.java
index c7110d5..0b77dac 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDynMembership.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractDynMembership.java
@@ -24,7 +24,7 @@ import org.apache.syncope.core.persistence.api.entity.Any;
 import org.apache.syncope.core.persistence.api.entity.DynMembership;
 
 @MappedSuperclass
-public abstract class AbstractDynMembership<A extends Any<?, ?>>
+public abstract class AbstractDynMembership<A extends Any<?>>
         extends AbstractEntity<Long> implements DynMembership<A> {
 
     private static final long serialVersionUID = 921821654690948787L;

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
index fdd257e..f892a8d 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttr.java
@@ -25,6 +25,7 @@ import javax.persistence.Column;
 import javax.persistence.FetchType;
 import javax.persistence.ManyToOne;
 import javax.persistence.MappedSuperclass;
+import javax.validation.constraints.NotNull;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.Transformer;
 import org.apache.syncope.core.persistence.api.entity.Any;
@@ -37,11 +38,11 @@ import 
org.apache.syncope.core.persistence.jpa.validation.entity.PlainAttrCheck;
 
 @MappedSuperclass
 @PlainAttrCheck
-public abstract class AbstractPlainAttr<O extends Any<?, ?>>
-        extends AbstractAttr<PlainSchema, O> implements PlainAttr<O> {
+public abstract class AbstractPlainAttr<O extends Any<?>> extends 
AbstractEntity<Long> implements PlainAttr<O> {
 
     private static final long serialVersionUID = -9115431608821806124L;
 
+    @NotNull
     @ManyToOne(fetch = FetchType.EAGER)
     @Column(name = "schema_name")
     protected JPAPlainSchema schema;
@@ -55,13 +56,20 @@ public abstract class AbstractPlainAttr<O extends Any<?, ?>>
     public void setSchema(final PlainSchema schema) {
         checkType(schema, JPAPlainSchema.class);
         this.schema = (JPAPlainSchema) schema;
-        checkSchema(this.schema);
     }
 
     protected abstract boolean addForMultiValue(PlainAttrValue attrValue);
 
+    private void checkNonNullSchema() {
+        if (schema == null) {
+            throw new IllegalStateException("First set owner then schema and 
finally add values");
+        }
+    }
+
     @Override
     public void add(final String value, final PlainAttrValue attrValue) {
+        checkNonNullSchema();
+
         attrValue.setAttr(this);
         getSchema().getValidator().validate(value, attrValue);
 
@@ -77,6 +85,8 @@ public abstract class AbstractPlainAttr<O extends Any<?, ?>>
 
     @Override
     public void add(final String value, final AnyUtils anyUtils) {
+        checkNonNullSchema();
+
         PlainAttrValue attrValue;
         if (getSchema().isUniqueConstraint()) {
             attrValue = anyUtils.newPlainAttrUniqueValue();

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyUtils.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyUtils.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyUtils.java
index 7de2fbe..22c632a 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyUtils.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyUtils.java
@@ -18,38 +18,55 @@
  */
 package org.apache.syncope.core.persistence.jpa.entity;
 
+import java.util.HashSet;
+import java.util.Set;
 import org.apache.syncope.common.lib.to.AnyObjectTO;
 import org.apache.syncope.common.lib.to.AnyTO;
 import org.apache.syncope.common.lib.to.GroupTO;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
+import org.apache.syncope.core.persistence.api.dao.UserDAO;
 import org.apache.syncope.core.persistence.api.entity.Any;
 import org.apache.syncope.core.persistence.api.entity.AnyUtils;
-import org.apache.syncope.core.persistence.api.entity.DerAttr;
 import org.apache.syncope.core.persistence.api.entity.PlainAttr;
 import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
-import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAADerAttr;
+import org.apache.syncope.core.persistence.api.entity.Schema;
+import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import 
org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.user.User;
 import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttr;
 import 
org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttrUniqueValue;
 import 
org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttrValue;
 import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAnyObject;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttr;
 import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr;
 import 
org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue;
 import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue;
 import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerAttr;
 import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttr;
 import 
org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrUniqueValue;
 import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrValue;
 import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 
 @SuppressWarnings({ "unchecked", "rawtypes" })
 public class JPAAnyUtils implements AnyUtils {
 
     private final AnyTypeKind anyTypeKind;
 
+    @Autowired
+    private UserDAO userDAO;
+
+    @Autowired
+    private GroupDAO groupDAO;
+
+    @Autowired
+    private AnyObjectDAO anyObjectDAO;
+
     protected JPAAnyUtils(final AnyTypeKind typeKind) {
         this.anyTypeKind = typeKind;
     }
@@ -60,7 +77,7 @@ public class JPAAnyUtils implements AnyUtils {
     }
 
     @Override
-    public <T extends Any<?, ?>> Class<T> anyClass() {
+    public <T extends Any<?>> Class<T> anyClass() {
         Class result;
 
         switch (anyTypeKind) {
@@ -216,52 +233,6 @@ public class JPAAnyUtils implements AnyUtils {
     }
 
     @Override
-    public <T extends DerAttr<?>> Class<T> derAttrClass() {
-        Class result = null;
-
-        switch (anyTypeKind) {
-            case USER:
-                result = JPAUDerAttr.class;
-                break;
-
-            case GROUP:
-                result = JPAGDerAttr.class;
-                break;
-
-            case ANY_OBJECT:
-                result = JPAADerAttr.class;
-                break;
-
-            default:
-        }
-
-        return result;
-    }
-
-    @Override
-    public <T extends DerAttr<?>> T newDerAttr() {
-        T result = null;
-
-        switch (anyTypeKind) {
-            case USER:
-                result = (T) new JPAUDerAttr();
-                break;
-
-            case GROUP:
-                result = (T) new JPAGDerAttr();
-                break;
-
-            case ANY_OBJECT:
-                result = (T) new JPAADerAttr();
-                break;
-
-            default:
-        }
-
-        return result;
-    }
-
-    @Override
     public IntMappingType plainIntMappingType() {
         IntMappingType result = null;
 
@@ -352,4 +323,36 @@ public class JPAAnyUtils implements AnyUtils {
 
         return result;
     }
+
+    @Transactional(readOnly = true)
+    @Override
+    public Set<ExternalResource> getAllResources(final Any<?> any) {
+        Set<ExternalResource> resources = new HashSet<>();
+
+        if (any instanceof User) {
+            resources.addAll(userDAO.findAllResources((User) any));
+        } else if (any instanceof Group) {
+            resources.addAll(((Group) any).getResources());
+        } else if (any instanceof AnyObject) {
+            resources.addAll(anyObjectDAO.findAllResources((AnyObject) any));
+        }
+
+        return resources;
+    }
+
+    @Transactional(readOnly = true)
+    @Override
+    public <S extends Schema> Set<S> getAllowedSchemas(final Any<?> any, final 
Class<S> reference) {
+        Set<S> schemas = new HashSet<>();
+
+        if (any instanceof User) {
+            schemas.addAll(userDAO.findAllowedSchemas((User) any, reference));
+        } else if (any instanceof Group) {
+            schemas.addAll(groupDAO.findAllowedSchemas((Group) any, 
reference));
+        } else if (any instanceof AnyObject) {
+            schemas.addAll(anyObjectDAO.findAllowedSchemas((AnyObject) any, 
reference));
+        }
+
+        return schemas;
+    }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyUtilsFactory.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyUtilsFactory.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyUtilsFactory.java
index 38e08b4..6aaf62d 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyUtilsFactory.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyUtilsFactory.java
@@ -18,7 +18,10 @@
  */
 package org.apache.syncope.core.persistence.jpa.entity;
 
+import java.util.HashMap;
+import java.util.Map;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
 import org.apache.syncope.core.persistence.api.entity.Any;
 import org.apache.syncope.core.persistence.api.entity.AnyUtils;
 import org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory;
@@ -30,18 +33,25 @@ import org.springframework.stereotype.Component;
 @Component
 public class JPAAnyUtilsFactory implements AnyUtilsFactory {
 
+    private final Map<AnyTypeKind, AnyUtils> instances = new HashMap<>(3);
+
     @Override
     public AnyUtils getInstance(final AnyTypeKind anyTypeKind) {
-        return new JPAAnyUtils(anyTypeKind);
-    }
+        AnyUtils instance;
+        synchronized (instances) {
+            instance = instances.get(anyTypeKind);
+            if (instance == null) {
+                instance = new JPAAnyUtils(anyTypeKind);
+                
ApplicationContextProvider.getBeanFactory().autowireBean(instance);
+                instances.put(anyTypeKind, instance);
+            }
+        }
 
-    @Override
-    public AnyUtils getInstance(final String anyTypeKind) {
-        return new JPAAnyUtils(AnyTypeKind.valueOf(anyTypeKind));
+        return instance;
     }
 
     @Override
-    public AnyUtils getInstance(final Any<?, ?> any) {
+    public AnyUtils getInstance(final Any<?> any) {
         AnyTypeKind type = null;
         if (any instanceof User) {
             type = AnyTypeKind.USER;
@@ -55,7 +65,7 @@ public class JPAAnyUtilsFactory implements AnyUtilsFactory {
             throw new IllegalArgumentException("Any type not supported: " + 
any.getClass().getName());
         }
 
-        return new JPAAnyUtils(type);
+        return getInstance(type);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
index 372e062..a31392f 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
@@ -60,7 +60,6 @@ import 
org.apache.syncope.core.persistence.api.entity.conf.CPlainAttr;
 import 
org.apache.syncope.core.persistence.api.entity.conf.CPlainAttrUniqueValue;
 import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttrValue;
 import org.apache.syncope.core.persistence.api.entity.conf.Conf;
-import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
 import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
 import 
org.apache.syncope.core.persistence.api.entity.group.GPlainAttrUniqueValue;
 import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
@@ -77,7 +76,6 @@ import 
org.apache.syncope.core.persistence.api.entity.task.SchedTask;
 import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
 import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
 import org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion;
-import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
 import org.apache.syncope.core.persistence.api.entity.user.UDynGroupMembership;
 import org.apache.syncope.core.persistence.api.entity.user.UMembership;
 import org.apache.syncope.core.persistence.api.entity.user.UPlainAttr;
@@ -96,7 +94,6 @@ import 
org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttr;
 import 
org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrUniqueValue;
 import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrValue;
 import org.apache.syncope.core.persistence.jpa.entity.conf.JPAConf;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttr;
 import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr;
 import 
org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue;
 import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue;
@@ -112,7 +109,6 @@ import 
org.apache.syncope.core.persistence.jpa.entity.task.JPAPushTask;
 import org.apache.syncope.core.persistence.jpa.entity.task.JPASchedTask;
 import org.apache.syncope.core.persistence.jpa.entity.task.JPASyncTask;
 import org.apache.syncope.core.persistence.jpa.entity.task.JPATaskExec;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerAttr;
 import 
org.apache.syncope.core.persistence.jpa.entity.user.JPAUDynGroupMembership;
 import org.apache.syncope.core.persistence.jpa.entity.user.JPAUMembership;
 import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttr;
@@ -194,8 +190,6 @@ public class JPAEntityFactory implements EntityFactory {
             result = (T) new JPAUPlainAttrUniqueValue();
         } else if (reference.equals(DerSchema.class)) {
             result = (T) new JPADerSchema();
-        } else if (reference.equals(UDerAttr.class)) {
-            result = (T) new JPAUDerAttr();
         } else if (reference.equals(VirSchema.class)) {
             result = (T) new JPAVirSchema();
         } else if (reference.equals(Mapping.class)) {
@@ -208,8 +202,6 @@ public class JPAEntityFactory implements EntityFactory {
             result = (T) new JPAGPlainAttrValue();
         } else if (reference.equals(GPlainAttrUniqueValue.class)) {
             result = (T) new JPAGPlainAttrUniqueValue();
-        } else if (reference.equals(GDerAttr.class)) {
-            result = (T) new JPAGDerAttr();
         } else if (reference.equals(CPlainAttr.class)) {
             result = (T) new JPACPlainAttr();
         } else if (reference.equals(CPlainAttrValue.class)) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAADerAttr.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAADerAttr.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAADerAttr.java
deleted file mode 100644
index 1525de9..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAADerAttr.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.persistence.jpa.entity.anyobject;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.anyobject.ADerAttr;
-import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttr;
-
-@Entity
-@Table(name = JPAADerAttr.TABLE)
-public class JPAADerAttr extends AbstractDerAttr<AnyObject> implements 
ADerAttr {
-
-    private static final long serialVersionUID = 5828533701103533330L;
-
-    public static final String TABLE = "ADerAttr";
-
-    @Id
-    private Long id;
-
-    @ManyToOne
-    private JPAAnyObject owner;
-
-    @Override
-    public Long getKey() {
-        return id;
-    }
-
-    @Override
-    public AnyObject getOwner() {
-        return owner;
-    }
-
-    @Override
-    public void setOwner(final AnyObject owner) {
-        checkType(owner, JPAAnyObject.class);
-        this.owner = (JPAAnyObject) owner;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAAnyObject.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAAnyObject.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAAnyObject.java
index 9d69735..10ba2fb 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAAnyObject.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAAnyObject.java
@@ -33,12 +33,12 @@ import javax.persistence.ManyToOne;
 import javax.persistence.OneToMany;
 import javax.persistence.Table;
 import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.Predicate;
 import org.apache.syncope.core.persistence.api.entity.AnyType;
 import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
 import org.apache.syncope.core.persistence.api.entity.RelationshipType;
-import org.apache.syncope.core.persistence.api.entity.anyobject.ADerAttr;
 import org.apache.syncope.core.persistence.api.entity.anyobject.AMembership;
 import org.apache.syncope.core.persistence.api.entity.anyobject.APlainAttr;
 import org.apache.syncope.core.persistence.api.entity.anyobject.ARelationship;
@@ -51,7 +51,7 @@ import 
org.apache.syncope.core.persistence.jpa.entity.resource.JPAExternalResour
 @Entity
 @Table(name = JPAAnyObject.TABLE)
 @Cacheable
-public class JPAAnyObject extends AbstractAny<APlainAttr, ADerAttr> implements 
AnyObject {
+public class JPAAnyObject extends AbstractAny<APlainAttr> implements AnyObject 
{
 
     private static final long serialVersionUID = 9063766472970643492L;
 
@@ -60,6 +60,7 @@ public class JPAAnyObject extends AbstractAny<APlainAttr, 
ADerAttr> implements A
     @Id
     private Long id;
 
+    @NotNull
     @ManyToOne(fetch = FetchType.EAGER, optional = false)
     private JPAAnyType type;
 
@@ -67,10 +68,6 @@ public class JPAAnyObject extends AbstractAny<APlainAttr, 
ADerAttr> implements A
     @Valid
     private List<JPAAPlainAttr> plainAttrs = new ArrayList<>();
 
-    @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
-    @Valid
-    private List<JPAADerAttr> derAttrs = new ArrayList<>();
-
     @ManyToMany(fetch = FetchType.EAGER)
     @JoinTable(joinColumns =
             @JoinColumn(name = "anyObject_id"),
@@ -127,23 +124,6 @@ public class JPAAnyObject extends AbstractAny<APlainAttr, 
ADerAttr> implements A
     }
 
     @Override
-    public boolean add(final ADerAttr attr) {
-        checkType(attr, JPAADerAttr.class);
-        return derAttrs.add((JPAADerAttr) attr);
-    }
-
-    @Override
-    public boolean remove(final ADerAttr attr) {
-        checkType(attr, JPAADerAttr.class);
-        return derAttrs.remove((JPAADerAttr) attr);
-    }
-
-    @Override
-    public List<? extends ADerAttr> getDerAttrs() {
-        return derAttrs;
-    }
-
-    @Override
     protected List<JPAExternalResource> internalGetResources() {
         return resources;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/conf/JPAConf.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/conf/JPAConf.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/conf/JPAConf.java
index ac5616a..b481fb0 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/conf/JPAConf.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/conf/JPAConf.java
@@ -21,7 +21,6 @@ package org.apache.syncope.core.persistence.jpa.entity.conf;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.Set;
 import javax.persistence.Cacheable;
 import javax.persistence.CascadeType;
 import javax.persistence.Entity;
@@ -33,11 +32,7 @@ import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.Predicate;
 import org.apache.syncope.core.persistence.api.entity.AnyType;
 import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
-import org.apache.syncope.core.persistence.api.entity.DerAttr;
-import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
 import org.apache.syncope.core.persistence.api.entity.Realm;
-import org.apache.syncope.core.persistence.api.entity.VirSchema;
 import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttr;
 import org.apache.syncope.core.persistence.api.entity.conf.Conf;
 import 
org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
@@ -99,26 +94,6 @@ public class JPAConf extends AbstractAnnotatedEntity<Long> 
implements Conf {
     }
 
     @Override
-    public boolean add(final DerAttr<?> attr) {
-        return false;
-    }
-
-    @Override
-    public boolean remove(final DerAttr<?> derAttr) {
-        return false;
-    }
-
-    @Override
-    public DerAttr<?> getDerAttr(final String derSchemaName) {
-        return null;
-    }
-
-    @Override
-    public List<? extends DerAttr<?>> getDerAttrs() {
-        return Collections.emptyList();
-    }
-
-    @Override
     public boolean add(final ExternalResource resource) {
         return false;
     }
@@ -192,19 +167,4 @@ public class JPAConf extends AbstractAnnotatedEntity<Long> 
implements Conf {
     public void setType(final AnyType type) {
         // nothing to do
     }
-
-    @Override
-    public Set<PlainSchema> getAllowedPlainSchemas() {
-        return Collections.emptySet();
-    }
-
-    @Override
-    public Set<DerSchema> getAllowedDerSchemas() {
-        return Collections.emptySet();
-    }
-
-    @Override
-    public Set<VirSchema> getAllowedVirSchemas() {
-        return Collections.emptySet();
-    }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttr.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttr.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttr.java
deleted file mode 100644
index 73911f8..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttr.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.persistence.jpa.entity.group;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttr;
-
-@Entity
-@Table(name = JPAGDerAttr.TABLE)
-public class JPAGDerAttr extends AbstractDerAttr<Group> implements GDerAttr {
-
-    private static final long serialVersionUID = 8007080005675899946L;
-
-    public static final String TABLE = "GDerAttr";
-
-    @Id
-    private Long id;
-
-    @ManyToOne
-    private JPAGroup owner;
-
-    @Override
-    public Long getKey() {
-        return id;
-    }
-
-    @Override
-    public Group getOwner() {
-        return owner;
-    }
-
-    @Override
-    public void setOwner(final Group owner) {
-        checkType(owner, JPAGroup.class);
-        this.owner = (JPAGroup) owner;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java
index 2fb84b5..d41ef3a 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java
@@ -42,7 +42,6 @@ import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
 import org.apache.syncope.core.persistence.api.entity.AnyType;
 import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
 import 
org.apache.syncope.core.persistence.api.entity.anyobject.ADynGroupMembership;
-import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
 import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
 import org.apache.syncope.core.persistence.api.entity.group.Group;
 import org.apache.syncope.core.persistence.api.entity.group.TypeExtension;
@@ -60,7 +59,7 @@ import 
org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
 @Table(name = JPAGroup.TABLE)
 @Cacheable
 @GroupCheck
-public class JPAGroup extends AbstractAny<GPlainAttr, GDerAttr> implements 
Group {
+public class JPAGroup extends AbstractAny<GPlainAttr> implements Group {
 
     private static final long serialVersionUID = -5281258853142421875L;
 
@@ -83,10 +82,6 @@ public class JPAGroup extends AbstractAny<GPlainAttr, 
GDerAttr> implements Group
     @Valid
     private List<JPAGPlainAttr> plainAttrs = new ArrayList<>();
 
-    @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
-    @Valid
-    private List<JPAGDerAttr> derAttrs = new ArrayList<>();
-
     @ManyToMany(fetch = FetchType.EAGER)
     @JoinTable(joinColumns =
             @JoinColumn(name = "group_id"),
@@ -183,23 +178,6 @@ public class JPAGroup extends AbstractAny<GPlainAttr, 
GDerAttr> implements Group
     }
 
     @Override
-    public boolean add(final GDerAttr attr) {
-        checkType(attr, JPAGDerAttr.class);
-        return derAttrs.add((JPAGDerAttr) attr);
-    }
-
-    @Override
-    public boolean remove(final GDerAttr attr) {
-        checkType(attr, JPAGDerAttr.class);
-        return derAttrs.remove((JPAGDerAttr) attr);
-    }
-
-    @Override
-    public List<? extends GDerAttr> getDerAttrs() {
-        return derAttrs;
-    }
-
-    @Override
     public ADynGroupMembership getADynMembership() {
         return aDynMembership;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUDerAttr.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUDerAttr.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUDerAttr.java
deleted file mode 100644
index 754fd59..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUDerAttr.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.persistence.jpa.entity.user;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttr;
-
-@Entity
-@Table(name = JPAUDerAttr.TABLE)
-public class JPAUDerAttr extends AbstractDerAttr<User> implements UDerAttr {
-
-    private static final long serialVersionUID = 4723044452807292060L;
-
-    public static final String TABLE = "UDerAttr";
-
-    @Id
-    private Long id;
-
-    @ManyToOne
-    private JPAUser owner;
-
-    @Override
-    public Long getKey() {
-        return id;
-    }
-
-    @Override
-    public User getOwner() {
-        return owner;
-    }
-
-    @Override
-    public void setOwner(final User owner) {
-        checkType(owner, JPAUser.class);
-        this.owner = (JPAUser) owner;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
index 9ba4fea..26fd229 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
@@ -52,7 +52,6 @@ import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.Predicate;
 import org.apache.syncope.common.lib.types.CipherAlgorithm;
 import org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion;
-import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
 import org.apache.syncope.core.persistence.api.entity.user.UPlainAttr;
 import org.apache.syncope.core.persistence.api.entity.user.User;
 import 
org.apache.syncope.core.persistence.jpa.entity.resource.JPAExternalResource;
@@ -74,7 +73,7 @@ import org.apache.syncope.core.persistence.jpa.entity.JPARole;
 @Entity
 @Table(name = JPAUser.TABLE)
 @Cacheable
-public class JPAUser extends AbstractAny<UPlainAttr, UDerAttr> implements User 
{
+public class JPAUser extends AbstractAny<UPlainAttr> implements User {
 
     private static final long serialVersionUID = -3905046855521446823L;
 
@@ -100,10 +99,6 @@ public class JPAUser extends AbstractAny<UPlainAttr, 
UDerAttr> implements User {
     @Valid
     private List<JPAUPlainAttr> plainAttrs = new ArrayList<>();
 
-    @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
-    @Valid
-    private List<JPAUDerAttr> derAttrs = new ArrayList<>();
-
     private String workflowId;
 
     @Column(nullable = true)
@@ -300,23 +295,6 @@ public class JPAUser extends AbstractAny<UPlainAttr, 
UDerAttr> implements User {
     }
 
     @Override
-    public boolean add(final UDerAttr attr) {
-        checkType(attr, JPAUDerAttr.class);
-        return derAttrs.add((JPAUDerAttr) attr);
-    }
-
-    @Override
-    public boolean remove(final UDerAttr attr) {
-        checkType(attr, JPAUDerAttr.class);
-        return derAttrs.remove((JPAUDerAttr) attr);
-    }
-
-    @Override
-    public List<? extends UDerAttr> getDerAttrs() {
-        return derAttrs;
-    }
-
-    @Override
     public String getWorkflowId() {
         return workflowId;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/AnyCheck.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/AnyCheck.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/AnyCheck.java
new file mode 100644
index 0000000..57a84e7
--- /dev/null
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/AnyCheck.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.validation.entity;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+@Target({ ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+@Constraint(validatedBy = AnyValidator.class)
+@Documented
+public @interface AnyCheck {
+
+    String message() default 
"{org.apache.syncope.core.persistence.validation.any}";
+
+    Class<?>[] groups() default {};
+
+    Class<? extends Payload>[] payload() default {};
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/AnyValidator.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/AnyValidator.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/AnyValidator.java
new file mode 100644
index 0000000..fb28c4e
--- /dev/null
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/AnyValidator.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.validation.entity;
+
+import java.util.Collection;
+import javax.validation.ConstraintValidatorContext;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
+import org.apache.syncope.common.lib.types.EntityViolationType;
+import org.apache.syncope.core.persistence.api.entity.Any;
+import org.apache.syncope.core.persistence.api.entity.PlainAttr;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+import org.apache.syncope.core.persistence.api.entity.conf.Conf;
+import org.apache.syncope.core.persistence.jpa.entity.JPAAnyUtilsFactory;
+
+@SuppressWarnings("rawtypes")
+public class AnyValidator extends AbstractValidator<AnyCheck, Any> {
+
+    @Override
+    public boolean isValid(final Any any, final ConstraintValidatorContext 
context) {
+        context.disableDefaultConstraintViolation();
+
+        if (!(any instanceof Conf)) {
+            Collection<String> allowedPlainSchemas = 
CollectionUtils.collect(new JPAAnyUtilsFactory().
+                    
getInstance(any.getType().getKind()).getAllowedSchemas(any, PlainSchema.class),
+                    new Transformer<PlainSchema, String>() {
+
+                @Override
+                public String transform(final PlainSchema schema) {
+                    return schema.getKey();
+                }
+            });
+
+            for (PlainAttr<?> attr : ((Any<?>) any).getPlainAttrs()) {
+                if (attr != null && 
!allowedPlainSchemas.contains(attr.getSchema().getKey())) {
+                    context.buildConstraintViolationWithTemplate(
+                            getTemplate(EntityViolationType.InvalidPlainSchema,
+                                    attr.getSchema().getKey() + " not allowed 
for this instance")).
+                            
addPropertyNode("plainAttrs").addConstraintViolation();
+                    return false;
+                }
+            }
+        }
+
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/EntityValidationListener.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/EntityValidationListener.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/EntityValidationListener.java
index f1df70c..0b60c5e 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/EntityValidationListener.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/EntityValidationListener.java
@@ -28,7 +28,6 @@ import 
org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntit
 import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
 import org.apache.syncope.core.persistence.api.entity.AnnotatedEntity;
 import org.apache.syncope.core.persistence.api.entity.Any;
-import org.apache.syncope.core.persistence.api.entity.Attr;
 import org.apache.syncope.core.persistence.api.entity.Entity;
 import org.apache.syncope.core.persistence.api.entity.Policy;
 import org.apache.syncope.core.persistence.api.entity.Schema;
@@ -59,7 +58,6 @@ public class EntityValidationListener {
                 if (!Entity.class.equals(interf)
                         && !AnnotatedEntity.class.equals(interf)
                         && !Schema.class.equals(interf)
-                        && !Attr.class.equals(interf)
                         && !Task.class.equals(interf)
                         && !Policy.class.equals(interf)
                         && !Any.class.equals(interf)

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java
index e7f3a85..d328eac 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java
@@ -66,6 +66,20 @@ public class ExternalResourceValidator extends 
AbstractValidator<ExternalResourc
             return false;
         }
 
+        if (item.getIntMappingType() == IntMappingType.AnyObjectDerivedSchema
+                || item.getIntMappingType() == 
IntMappingType.GroupDerivedSchema
+                || item.getIntMappingType() == 
IntMappingType.UserDerivedSchema) {
+
+            if (item.getPurpose() != MappingPurpose.PROPAGATION) {
+                context.buildConstraintViolationWithTemplate(
+                        getTemplate(EntityViolationType.InvalidMapping,
+                                " - only " + MappingPurpose.PROPAGATION.name() 
+ " allowed for derived")).
+                        addPropertyNode("purpose").addConstraintViolation();
+
+                return false;
+            }
+        }
+
         if (item.getIntMappingType() == IntMappingType.AnyObjectVirtualSchema
                 || item.getIntMappingType() == 
IntMappingType.GroupVirtualSchema
                 || item.getIntMappingType() == 
IntMappingType.UserVirtualSchema) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml 
b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
index 5ddee8c..15ff3aa 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
@@ -312,31 +312,6 @@ under the License.
     </attributes>
   </entity>
 
-  <entity 
class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAADerAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ADerAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_ADerAttr" pk-column-value="SEQ_ADerAttr" 
initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity 
class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UDerAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_UDerAttr" pk-column-value="SEQ_UDerAttr" 
initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity 
class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_GDerAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_GDerAttr" pk-column-value="SEQ_GDerAttr" 
initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
   <entity 
class="org.apache.syncope.core.persistence.jpa.entity.JPAAnyTemplateRealm">
     <attributes>
       <id name="id">

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml 
b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
index 5ddee8c..15ff3aa 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
@@ -312,31 +312,6 @@ under the License.
     </attributes>
   </entity>
 
-  <entity 
class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAADerAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ADerAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_ADerAttr" pk-column-value="SEQ_ADerAttr" 
initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity 
class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UDerAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_UDerAttr" pk-column-value="SEQ_UDerAttr" 
initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity 
class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_GDerAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_GDerAttr" pk-column-value="SEQ_GDerAttr" 
initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
   <entity 
class="org.apache.syncope.core.persistence.jpa.entity.JPAAnyTemplateRealm">
     <attributes>
       <id name="id">

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml 
b/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
index f4f2b07..aeb24ee 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
@@ -359,31 +359,6 @@ under the License.
       </id>
     </attributes>
   </entity>
-
-  <entity 
class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAADerAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ADerAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_ADerAttr" pk-column-value="SEQ_ADerAttr" 
initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity 
class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UDerAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_UDerAttr" pk-column-value="SEQ_UDerAttr" 
initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity 
class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_GDerAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_GDerAttr" pk-column-value="SEQ_GDerAttr" 
initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
   
   <entity 
class="org.apache.syncope.core.persistence.jpa.entity.JPAAnyTemplateRealm">
     <attributes>

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/main/resources/indexes.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/indexes.xml 
b/core/persistence-jpa/src/main/resources/indexes.xml
index a2d4c62..3807b35 100644
--- a/core/persistence-jpa/src/main/resources/indexes.xml
+++ b/core/persistence-jpa/src/main/resources/indexes.xml
@@ -64,9 +64,5 @@ under the License.
   <entry key="GPlainAttr_owner_id_index">CREATE INDEX 
GPlainAttr_owner_id_index on GPlainAttr(owner_id)</entry>
   <entry key="APlainAttr_owner_id_index">CREATE INDEX 
APlainAttr_owner_id_index on APlainAttr(owner_id)</entry>
 
-  <entry key="UDerAttr_owner_id_index">CREATE INDEX UDerAttr_owner_id_index on 
UDerAttr(owner_id)</entry>
-  <entry key="GDerAttr_owner_id_index">CREATE INDEX GDerAttr_owner_id_index on 
GDerAttr(owner_id)</entry>
-  <entry key="ADerAttr_owner_id_index">CREATE INDEX ADerAttr_owner_id_index on 
ADerAttr(owner_id)</entry>
-
   <entry key="Task_executedIndex">CREATE INDEX Task_executedIndex ON 
Task(executed)</entry>
 </properties>

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConfTest.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConfTest.java
 
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConfTest.java
index 38332b6..c361614 100644
--- 
a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConfTest.java
+++ 
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConfTest.java
@@ -83,6 +83,7 @@ public class ConfTest extends AbstractTest {
 
         // 2. create conf
         CPlainAttr newConf = entityFactory.newEntity(CPlainAttr.class);
+        newConf.setOwner(confDAO.get());
         newConf.setSchema(useless);
         add(newConf, "2014-06-20");
         confDAO.save(newConf);

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/DerAttrTest.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/DerAttrTest.java
 
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/DerAttrTest.java
deleted file mode 100644
index 3fb15b7..0000000
--- 
a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/DerAttrTest.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.persistence.jpa.inner;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-import org.apache.syncope.core.persistence.api.dao.AnyTypeClassDAO;
-import org.apache.syncope.core.persistence.api.dao.DerAttrDAO;
-import org.apache.syncope.core.persistence.api.dao.DerSchemaDAO;
-import org.apache.syncope.core.persistence.api.dao.GroupDAO;
-import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
-import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
-import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
-import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional("Master")
-public class DerAttrTest extends AbstractTest {
-
-    @Autowired
-    private DerAttrDAO derAttrDAO;
-
-    @Autowired
-    private UserDAO userDAO;
-
-    @Autowired
-    private GroupDAO groupDAO;
-
-    @Autowired
-    private DerSchemaDAO derSchemaDAO;
-
-    @Autowired
-    private AnyTypeClassDAO anyTypeClassDAO;
-
-    @Test
-    public void findAll() {
-        List<UDerAttr> list = derAttrDAO.findAll(UDerAttr.class);
-        assertEquals("did not get expected number of derived attributes ", 2, 
list.size());
-    }
-
-    @Test
-    public void findById() {
-        UDerAttr attribute = derAttrDAO.find(100L, UDerAttr.class);
-        assertNotNull("did not find expected attribute schema", attribute);
-    }
-
-    @Test
-    public void saveUDerAttribute() {
-        DerSchema cnSchema = derSchemaDAO.find("cn");
-        assertNotNull(cnSchema);
-
-        User owner = userDAO.find(3L);
-        assertNotNull("did not get expected user", owner);
-
-        UDerAttr derAttr = entityFactory.newEntity(UDerAttr.class);
-        derAttr.setOwner(owner);
-        derAttr.setSchema(cnSchema);
-
-        derAttr = derAttrDAO.save(derAttr);
-
-        UDerAttr actual = derAttrDAO.find(derAttr.getKey(), UDerAttr.class);
-        assertNotNull("expected save to work", actual);
-        assertEquals(derAttr, actual);
-
-        UPlainAttrValue firstname = 
owner.getPlainAttr("firstname").getValues().iterator().next();
-        UPlainAttrValue surname = 
owner.getPlainAttr("surname").getValues().iterator().next();
-
-        assertEquals(surname.getValue() + ", " + firstname.getValue(), 
derAttr.getValue(owner.getPlainAttrs()));
-    }
-
-    @Test
-    public void saveGDerAttribute() {
-        DerSchema schema = derSchemaDAO.find("rderiveddata");
-        assertNotNull(schema);
-
-        Group owner = groupDAO.find(1L);
-        assertNotNull("did not get expected user", owner);
-
-        GDerAttr derAttr = entityFactory.newEntity(GDerAttr.class);
-        derAttr.setOwner(owner);
-        derAttr.setSchema(schema);
-
-        derAttr = derAttrDAO.save(derAttr);
-
-        GDerAttr actual = derAttrDAO.find(derAttr.getKey(), GDerAttr.class);
-        assertNotNull("expected save to work", actual);
-        assertEquals(derAttr, actual);
-
-        GPlainAttrValue sx = 
owner.getPlainAttr("rderived_sx").getValues().iterator().next();
-        GPlainAttrValue dx = 
owner.getPlainAttr("rderived_dx").getValues().iterator().next();
-
-        assertEquals(sx.getValue() + "-" + dx.getValue(), 
derAttr.getValue(owner.getPlainAttrs()));
-    }
-
-    @Test
-    public void delete() {
-        UDerAttr attribute = derAttrDAO.find(100L, UDerAttr.class);
-        String schemaName = attribute.getSchema().getKey();
-
-        derAttrDAO.delete(attribute.getKey(), UDerAttr.class);
-
-        UDerAttr actual = derAttrDAO.find(100L, UDerAttr.class);
-        assertNull("delete did not work", actual);
-
-        DerSchema attributeSchema = derSchemaDAO.find(schemaName);
-        assertNotNull("user derived attribute schema deleted when deleting 
values", attributeSchema);
-    }
-
-    @Test
-    public void issueSYNCOPE134User() {
-        AnyTypeClass other = anyTypeClassDAO.find("other");
-
-        DerSchema sderived = entityFactory.newEntity(DerSchema.class);
-        sderived.setKey("sderived");
-        sderived.setExpression("status + ' - ' + username + ' - ' + 
creationDate + '[' + failedLogins + ']'");
-
-        sderived = derSchemaDAO.save(sderived);
-
-        derSchemaDAO.flush();
-
-        other.add(sderived);
-        sderived.setAnyTypeClass(other);
-
-        derSchemaDAO.flush();
-
-        sderived = derSchemaDAO.find("sderived");
-        assertNotNull("expected save to work", sderived);
-        assertEquals(other, sderived.getAnyTypeClass());
-
-        User owner = userDAO.find(3L);
-        assertNotNull("did not get expected user", owner);
-        owner.add(other);
-
-        UDerAttr derAttr = entityFactory.newEntity(UDerAttr.class);
-        derAttr.setOwner(owner);
-        derAttr.setSchema(sderived);
-
-        derAttr = derAttrDAO.save(derAttr);
-        derAttrDAO.flush();
-
-        derAttr = derAttrDAO.find(derAttr.getKey(), UDerAttr.class);
-        assertNotNull("expected save to work", derAttr);
-
-        String value = derAttr.getValue(owner.getPlainAttrs());
-        assertNotNull(value);
-        assertFalse(value.isEmpty());
-        assertTrue(value.startsWith("active - vivaldi - 2010-10-20"));
-        assertTrue(value.endsWith("[0]"));
-    }
-
-    @Test
-    public void issueSYNCOPE134Group() {
-        AnyTypeClass genericMembership = anyTypeClassDAO.find("generic 
membership");
-
-        DerSchema sderived = entityFactory.newEntity(DerSchema.class);
-        sderived.setKey("sderived");
-        sderived.setExpression("name");
-
-        sderived = derSchemaDAO.save(sderived);
-
-        derSchemaDAO.flush();
-
-        genericMembership.add(sderived);
-        sderived.setAnyTypeClass(genericMembership);
-
-        derSchemaDAO.flush();
-
-        sderived = derSchemaDAO.find("sderived");
-        assertNotNull("expected save to work", sderived);
-        assertEquals(genericMembership, sderived.getAnyTypeClass());
-
-        Group owner = groupDAO.find(7L);
-        assertNotNull("did not get expected group", owner);
-        owner.add(genericMembership);
-
-        GDerAttr derAttr = entityFactory.newEntity(GDerAttr.class);
-        derAttr.setOwner(owner);
-        derAttr.setSchema(sderived);
-
-        derAttr = derAttrDAO.save(derAttr);
-        derAttrDAO.flush();
-
-        derAttr = derAttrDAO.find(derAttr.getKey(), GDerAttr.class);
-        assertNotNull("expected save to work", derAttr);
-
-        String value = derAttr.getValue(owner.getPlainAttrs());
-        assertNotNull(value);
-        assertFalse(value.isEmpty());
-        assertTrue(value.startsWith("managingDirector"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/DerSchemaTest.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/DerSchemaTest.java
 
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/DerSchemaTest.java
index abe3de3..7907381 100644
--- 
a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/DerSchemaTest.java
+++ 
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/DerSchemaTest.java
@@ -43,7 +43,7 @@ public class DerSchemaTest extends AbstractTest {
     @Test
     public void findAll() {
         List<DerSchema> list = derSchemaDAO.findAll();
-        assertEquals(9, list.size());
+        assertEquals(10, list.size());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ResourceTest.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ResourceTest.java
 
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ResourceTest.java
index be37d88..3cc3efa 100644
--- 
a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ResourceTest.java
+++ 
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ResourceTest.java
@@ -338,7 +338,7 @@ public class ResourceTest extends AbstractTest {
         item.setIntAttrName("mderiveddata");
         item.setExtAttrName("mderiveddata");
         item.setIntMappingType(IntMappingType.AnyObjectDerivedSchema);
-        item.setPurpose(MappingPurpose.BOTH);
+        item.setPurpose(MappingPurpose.PROPAGATION);
         mapping.add(item);
 
         // save the resource

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/DerSchemaTest.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/DerSchemaTest.java
 
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/DerSchemaTest.java
deleted file mode 100644
index f4529f8..0000000
--- 
a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/DerSchemaTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.persistence.jpa.outer;
-
-import static org.junit.Assert.assertNull;
-
-import org.apache.syncope.core.persistence.api.dao.DerAttrDAO;
-import org.apache.syncope.core.persistence.api.dao.DerSchemaDAO;
-import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
-import org.apache.syncope.core.persistence.jpa.AbstractTest;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional("Master")
-public class DerSchemaTest extends AbstractTest {
-
-    @Autowired
-    private UserDAO userDAO;
-
-    @Autowired
-    private DerSchemaDAO derSchemaDAO;
-
-    @Autowired
-    private DerAttrDAO derAttrDAO;
-
-    @Test
-    public void test() {
-        DerSchema schema = derSchemaDAO.find("cn");
-
-        derSchemaDAO.delete(schema.getKey());
-
-        derSchemaDAO.flush();
-
-        assertNull(derSchemaDAO.find(schema.getKey()));
-        assertNull(derAttrDAO.find(100L, UDerAttr.class));
-        assertNull(userDAO.find(3L).getDerAttr(schema.getKey()));
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/eec66245/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainAttrTest.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainAttrTest.java
 
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainAttrTest.java
index 82147a2..331c4ca 100644
--- 
a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainAttrTest.java
+++ 
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainAttrTest.java
@@ -19,29 +19,12 @@
 package org.apache.syncope.core.persistence.jpa.outer;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
 
-import org.apache.syncope.common.lib.SyncopeConstants;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.common.lib.types.AttrSchemaType;
-import org.apache.syncope.common.lib.types.CipherAlgorithm;
-import org.apache.syncope.core.persistence.api.dao.AnyTypeClassDAO;
-import org.apache.syncope.core.persistence.api.dao.DerAttrDAO;
-import org.apache.syncope.core.persistence.api.dao.DerSchemaDAO;
 import org.apache.syncope.core.persistence.api.dao.PlainAttrDAO;
 import org.apache.syncope.core.persistence.api.dao.PlainAttrValueDAO;
-import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
-import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
-import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
 import org.apache.syncope.core.persistence.api.entity.user.UPlainAttr;
 import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.user.User;
 import org.apache.syncope.core.persistence.jpa.AbstractTest;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -54,23 +37,8 @@ public class PlainAttrTest extends AbstractTest {
     private PlainAttrDAO plainAttrDAO;
 
     @Autowired
-    private DerAttrDAO derAttrDAO;
-
-    @Autowired
     private PlainAttrValueDAO plainAttrValueDAO;
 
-    @Autowired
-    private PlainSchemaDAO plainSchemaDAO;
-
-    @Autowired
-    private DerSchemaDAO derSchemaDAO;
-
-    @Autowired
-    private UserDAO userDAO;
-
-    @Autowired
-    private AnyTypeClassDAO anyTypeClassDAO;
-
     @Test
     public void deleteAttribute() {
         plainAttrDAO.delete(117L, UPlainAttr.class);
@@ -95,85 +63,4 @@ public class PlainAttrTest extends AbstractTest {
         UPlainAttr attribute = plainAttrDAO.find(104L, UPlainAttr.class);
         assertEquals(attribute.getValues().size(), attributeValueNumber - 1);
     }
-
-    @Test
-    public void checkForEnumType() {
-        User user = userDAO.find(1L);
-        user.setPassword("password123", CipherAlgorithm.SHA);
-        assertNotNull(user);
-
-        AnyTypeClass other = anyTypeClassDAO.find("other");
-
-        PlainSchema color = entityFactory.newEntity(PlainSchema.class);
-        color.setType(AttrSchemaType.Enum);
-        color.setKey("color");
-        color.setEnumerationValues("red" + 
SyncopeConstants.ENUM_VALUES_SEPARATOR + "yellow");
-
-        color = plainSchemaDAO.save(color);
-
-        other.add(color);
-        color.setAnyTypeClass(other);
-
-        plainSchemaDAO.flush();
-
-        color = plainSchemaDAO.find("color");
-        assertNotNull("expected save to work", color);
-        assertEquals(other, color.getAnyTypeClass());
-
-        UPlainAttr attr = entityFactory.newEntity(UPlainAttr.class);
-        attr.setOwner(user);
-        attr.setSchema(color);
-        attr.add("yellow", anyUtilsFactory.getInstance(AnyTypeKind.USER));
-        user.add(attr);
-
-        userDAO.save(user);
-        userDAO.flush();
-
-        user = userDAO.find(1L);
-        assertNotNull(user);
-        assertNotNull(user.getPlainAttr(color.getKey()));
-        assertNotNull(user.getPlainAttr(color.getKey()).getValues());
-        assertEquals(user.getPlainAttr(color.getKey()).getValues().size(), 1);
-    }
-
-    @Test
-    public void derAttrFromSpecialAttrs() {
-        AnyTypeClass other = anyTypeClassDAO.find("other");
-
-        DerSchema sderived = entityFactory.newEntity(DerSchema.class);
-        sderived.setKey("sderived");
-        sderived.setExpression("username + ' - ' + creationDate + '[' + 
failedLogins + ']'");
-
-        sderived = derSchemaDAO.save(sderived);
-
-        derSchemaDAO.flush();
-
-        other.add(sderived);
-        sderived.setAnyTypeClass(other);
-
-        derSchemaDAO.flush();
-
-        sderived = derSchemaDAO.find("sderived");
-        assertNotNull("expected save to work", sderived);
-        assertEquals(other, sderived.getAnyTypeClass());
-
-        User owner = userDAO.find(3L);
-        assertNotNull("did not get expected user", owner);
-
-        UDerAttr derAttr = entityFactory.newEntity(UDerAttr.class);
-        derAttr.setOwner(owner);
-        derAttr.setSchema(sderived);
-
-        derAttr = derAttrDAO.save(derAttr);
-        derAttrDAO.flush();
-
-        derAttr = derAttrDAO.find(derAttr.getKey(), UDerAttr.class);
-        assertNotNull("expected save to work", derAttr);
-
-        String value = derAttr.getValue(owner.getPlainAttrs());
-        assertNotNull(value);
-        assertFalse(value.isEmpty());
-        assertTrue(value.startsWith("vivaldi - 2010-10-20"));
-        assertTrue(value.endsWith("[0]"));
-    }
 }

Reply via email to