You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2016/06/14 15:59:59 UTC

[08/15] syncope git commit: Unique schema key across the three tables

Unique schema key across the three tables


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/a4afd4a2
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/a4afd4a2
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/a4afd4a2

Branch: refs/heads/SYNCOPE-862
Commit: a4afd4a22daaff2c353de44d52dfc41412cdea4a
Parents: 579f4b0
Author: Francesco Chicchiricc� <il...@apache.org>
Authored: Thu Jun 9 18:20:30 2016 +0200
Committer: Francesco Chicchiricc� <il...@apache.org>
Committed: Tue Jun 14 17:59:30 2016 +0200

----------------------------------------------------------------------
 .../notification/NotificationResultManager.java |   1 -
 .../resource/ResourceResultManager.java         |   1 -
 .../syncope/common/lib/EntityTOUtils.java       |  18 -
 .../lib/policy/DefaultAccountRuleConf.java      |   7 +-
 .../lib/policy/DefaultPasswordRuleConf.java     |   7 +-
 .../common/lib/report/GroupReportletConf.java   |   9 +-
 .../syncope/common/lib/report/Schema.java       |   7 +-
 .../common/lib/report/UserReportletConf.java    |   9 +-
 .../common/lib/search/SearchableFields.java     |  17 +
 .../syncope/common/lib/to/MappingItemTO.java    |  14 -
 .../apache/syncope/common/lib/to/MappingTO.java |  12 -
 .../syncope/common/lib/to/NotificationTO.java   |  11 -
 .../common/lib/types/EntityViolationType.java   |   2 +-
 .../common/lib/types/IntMappingType.java        | 203 --------
 .../api/dao/ExternalResourceDAO.java            |   3 +-
 .../core/persistence/api/entity/AnyUtils.java   |   9 +-
 .../api/entity/LinkingMappingItem.java          |  21 -
 .../persistence/api/entity/Notification.java    |   5 -
 .../api/entity/resource/MappingItem.java        |   5 -
 .../api/search/SearchCondVisitor.java           |   4 +-
 .../persistence/jpa/dao/JPADerSchemaDAO.java    |   8 +-
 .../jpa/dao/JPAExternalResourceDAO.java         |  10 +-
 .../persistence/jpa/dao/JPAPlainSchemaDAO.java  |   2 +-
 .../persistence/jpa/dao/JPAVirSchemaDAO.java    |  11 +-
 .../persistence/jpa/entity/AbstractSchema.java  |  40 ++
 .../persistence/jpa/entity/JPAAnyUtils.java     | 131 +++--
 .../persistence/jpa/entity/JPADerSchema.java    |   8 +-
 .../persistence/jpa/entity/JPANotification.java |  15 -
 .../persistence/jpa/entity/JPAPlainSchema.java  |   6 +-
 .../persistence/jpa/entity/JPAVirSchema.java    |   8 +-
 .../entity/anyobject/JPAAPlainAttrValue.java    |   3 -
 .../jpa/entity/conf/JPACPlainAttrValue.java     |   3 -
 .../jpa/entity/group/JPAGPlainAttrValue.java    |   3 -
 .../jpa/entity/resource/JPAMapping.java         |  23 +-
 .../jpa/entity/resource/JPAMappingItem.java     |  50 +-
 .../jpa/entity/user/JPAUPlainAttrValue.java     |   3 -
 .../validation/entity/AbstractValidator.java    |   2 +-
 .../jpa/validation/entity/DomainValidator.java  |  12 +-
 .../entity/ExternalResourceValidator.java       |  64 +--
 .../validation/entity/PlainSchemaValidator.java |  36 +-
 .../entity/RelationshipTypeValidator.java       |   4 +-
 .../jpa/validation/entity/RoleValidator.java    |   6 +-
 .../validation/entity/SchemaKeyValidator.java   |  62 +--
 .../main/resources/domains/MasterContent.xml    |  17 +-
 .../core/persistence/jpa/inner/ConfTest.java    |   2 +-
 .../persistence/jpa/inner/DerSchemaTest.java    |   2 +-
 .../persistence/jpa/inner/NotificationTest.java |   4 -
 .../persistence/jpa/inner/PlainSchemaTest.java  |   7 +-
 .../persistence/jpa/inner/ResourceTest.java     |  30 +-
 .../persistence/jpa/inner/VirSchemaTest.java    |   2 +-
 .../persistence/jpa/outer/PlainSchemaTest.java  |  24 +
 .../persistence/jpa/outer/ResourceTest.java     |   5 -
 .../persistence/jpa/outer/VirSchemaTest.java    |   2 -
 .../test/resources/domains/MasterContent.xml    | 187 ++++---
 .../src/test/resources/domains/TwoContent.xml   |  11 +
 .../provisioning/api/IntAttrNameParser.java     | 140 ++++++
 .../core/provisioning/api/MappingManager.java   |   8 +-
 .../provisioning/java/MappingManagerImpl.java   | 501 +++++++++----------
 .../java/data/AbstractAnyDataBinder.java        |  16 +-
 .../java/data/NotificationDataBinderImpl.java   |   9 +
 .../java/data/ResourceDataBinderImpl.java       |  76 +--
 .../notification/NotificationManagerImpl.java   |  76 +--
 .../provisioning/java/pushpull/PullUtils.java   | 126 ++---
 .../java/ResourceDataBinderTest.java            |   2 -
 .../syncope/fit/core/ConfigurationITCase.java   |   2 +-
 .../syncope/fit/core/ConnectorITCase.java       |   2 -
 .../syncope/fit/core/DerSchemaITCase.java       |   2 +-
 .../apache/syncope/fit/core/GroupITCase.java    |   3 -
 .../syncope/fit/core/MigrationITCase.java       |  17 -
 .../syncope/fit/core/MultitenancyITCase.java    |   7 +-
 .../syncope/fit/core/NotificationITCase.java    |   2 -
 .../fit/core/NotificationTaskITCase.java        |   3 -
 .../syncope/fit/core/PlainSchemaITCase.java     |   4 +-
 .../apache/syncope/fit/core/PushTaskITCase.java |   3 -
 .../apache/syncope/fit/core/ResourceITCase.java |  36 +-
 .../apache/syncope/fit/core/VirAttrITCase.java  |   4 -
 .../syncope/fit/core/VirSchemaITCase.java       |   2 +-
 77 files changed, 953 insertions(+), 1256 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationResultManager.java
index 951f1c1..a364316 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationResultManager.java
@@ -40,7 +40,6 @@ public class NotificationResultManager extends CommonsResultManager {
         System.out.println("    recipient attribute name: " + notificationTO.getRecipientAttrName());
         System.out.println("    template: " + notificationTO.getTemplate());
         System.out.println("    abouts: " + notificationTO.getAbouts());
-        System.out.println("    recipient attribute types: " + notificationTO.getRecipientAttrType());
         System.out.println("    static recipient: " + notificationTO.getStaticRecipients());
         System.out.println("    trace level: " + notificationTO.getTraceLevel());
         System.out.println("    active: " + notificationTO.isActive());

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
index e396316..ca7c87a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
@@ -77,7 +77,6 @@ public class ResourceResultManager extends CommonsResultManager {
     private void printMappingItem(final List<MappingItemTO> mappingItemTOs) {
         for (final MappingItemTO mappingItemTO : mappingItemTOs) {
             System.out.println("             mapping key: " + mappingItemTO.getKey());
-            System.out.println("             mapping item type: " + mappingItemTO.getIntMappingType().name());
             System.out.println("             internal attribute name: " + mappingItemTO.getIntAttrName());
             System.out.println("             external attribute name: " + mappingItemTO.getExtAttrName());
             System.out.println("             mandatory condition: " + mappingItemTO.getMandatoryCondition());

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/common/lib/src/main/java/org/apache/syncope/common/lib/EntityTOUtils.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/EntityTOUtils.java b/common/lib/src/main/java/org/apache/syncope/common/lib/EntityTOUtils.java
index a715992..001e569 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/EntityTOUtils.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/EntityTOUtils.java
@@ -18,29 +18,11 @@
  */
 package org.apache.syncope.common.lib;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
 import org.apache.commons.collections4.Transformer;
-import org.apache.syncope.common.lib.search.SearchableFields;
-import org.apache.syncope.common.lib.to.AnyObjectTO;
 import org.apache.syncope.common.lib.to.EntityTO;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.lib.to.UserTO;
 
 public final class EntityTOUtils {
 
-    public static final List<String> ANY_FIELDS;
-
-    static {
-        List<String> anyFields = new ArrayList<>();
-        anyFields.addAll(SearchableFields.get(UserTO.class));
-        anyFields.addAll(SearchableFields.get(GroupTO.class));
-        anyFields.addAll(SearchableFields.get(AnyObjectTO.class));
-
-        ANY_FIELDS = Collections.unmodifiableList(anyFields);
-    }
-
     public static <E extends EntityTO> Transformer<E, String> keyTransformer() {
         return new Transformer<E, String>() {
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultAccountRuleConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultAccountRuleConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultAccountRuleConf.java
index 1d7cdb3..2788a4a 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultAccountRuleConf.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultAccountRuleConf.java
@@ -26,7 +26,8 @@ import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
 import org.apache.syncope.common.lib.report.Schema;
-import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.syncope.common.lib.types.SchemaType;
 
 @XmlRootElement(name = "defaultAccountRuleConf")
 @XmlType
@@ -67,8 +68,8 @@ public class DefaultAccountRuleConf extends AbstractAccountRuleConf implements A
     /**
      * User attribute values not permitted.
      */
-    @Schema(type
-            = { IntMappingType.UserPlainSchema, IntMappingType.UserDerivedSchema, IntMappingType.UserVirtualSchema })
+    @Schema(anyTypeKind = AnyTypeKind.USER,
+            type = { SchemaType.PLAIN, SchemaType.DERIVED, SchemaType.VIRTUAL })
     private final List<String> schemasNotPermitted = new ArrayList<>();
 
     /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPasswordRuleConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPasswordRuleConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPasswordRuleConf.java
index b75ff9c..b622546 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPasswordRuleConf.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPasswordRuleConf.java
@@ -26,7 +26,8 @@ import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
 import org.apache.syncope.common.lib.report.Schema;
-import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.syncope.common.lib.types.SchemaType;
 
 @XmlRootElement(name = "defaultPasswordRuleConf")
 @XmlType
@@ -142,8 +143,8 @@ public class DefaultPasswordRuleConf extends AbstractPasswordRuleConf {
     /**
      * User attribute values not permitted.
      */
-    @Schema(type
-            = { IntMappingType.UserPlainSchema, IntMappingType.UserDerivedSchema, IntMappingType.UserVirtualSchema })
+    @Schema(anyTypeKind = AnyTypeKind.USER,
+            type = { SchemaType.PLAIN, SchemaType.DERIVED, SchemaType.VIRTUAL })
     private final List<String> schemasNotPermitted = new ArrayList<>();
 
     /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/common/lib/src/main/java/org/apache/syncope/common/lib/report/GroupReportletConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/report/GroupReportletConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/report/GroupReportletConf.java
index 6712b30..6f3800a 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/report/GroupReportletConf.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/report/GroupReportletConf.java
@@ -26,7 +26,8 @@ import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlEnum;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.syncope.common.lib.types.SchemaType;
 
 @XmlRootElement(name = "groupReportletConf")
 @XmlType
@@ -47,13 +48,13 @@ public class GroupReportletConf extends AbstractAnyReportletConf {
 
     }
 
-    @Schema(type = IntMappingType.GroupPlainSchema)
+    @Schema(anyTypeKind = AnyTypeKind.GROUP, type = { SchemaType.PLAIN })
     private final List<String> plainAttrs = new ArrayList<>();
 
-    @Schema(type = IntMappingType.GroupDerivedSchema)
+    @Schema(anyTypeKind = AnyTypeKind.GROUP, type = { SchemaType.DERIVED })
     private final List<String> derAttrs = new ArrayList<>();
 
-    @Schema(type = IntMappingType.GroupVirtualSchema)
+    @Schema(anyTypeKind = AnyTypeKind.GROUP, type = { SchemaType.VIRTUAL })
     private final List<String> virAttrs = new ArrayList<>();
 
     @SearchCondition(type = "GROUP")

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/common/lib/src/main/java/org/apache/syncope/common/lib/report/Schema.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/report/Schema.java b/common/lib/src/main/java/org/apache/syncope/common/lib/report/Schema.java
index 31844af..c1771ba 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/report/Schema.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/report/Schema.java
@@ -22,11 +22,14 @@ import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
-import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.syncope.common.lib.types.SchemaType;
 
 @Target({ ElementType.FIELD })
 @Retention(RetentionPolicy.RUNTIME)
 public @interface Schema {
 
-    IntMappingType[] type() default { IntMappingType.UserPlainSchema };
+    SchemaType[] type() default { SchemaType.PLAIN };
+
+    AnyTypeKind anyTypeKind();
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java
index 8f6de9f..0a5455d 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java
@@ -26,7 +26,8 @@ import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlEnum;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.syncope.common.lib.types.SchemaType;
 
 @XmlRootElement(name = "userReportletConf")
 @XmlType
@@ -34,13 +35,13 @@ public class UserReportletConf extends AbstractAnyReportletConf {
 
     private static final long serialVersionUID = 6602717600064602764L;
 
-    @Schema(type = IntMappingType.UserPlainSchema)
+    @Schema(anyTypeKind = AnyTypeKind.USER, type = { SchemaType.PLAIN })
     private final List<String> plainAttrs = new ArrayList<>();
 
-    @Schema(type = IntMappingType.UserDerivedSchema)
+    @Schema(anyTypeKind = AnyTypeKind.USER, type = { SchemaType.DERIVED })
     private final List<String> derAttrs = new ArrayList<>();
 
-    @Schema(type = IntMappingType.UserVirtualSchema)
+    @Schema(anyTypeKind = AnyTypeKind.USER, type = { SchemaType.VIRTUAL })
     private final List<String> virAttrs = new ArrayList<>();
 
     @XmlEnum

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java
index 6443eea..0912cf9 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java
@@ -22,10 +22,15 @@ import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import org.apache.commons.lang3.ArrayUtils;
+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;
 
 public final class SearchableFields {
@@ -34,6 +39,18 @@ public final class SearchableFields {
         "serialVersionUID", "password"
     };
 
+    private static final Set<String> ANY_FIELDS = new HashSet<>();
+
+    static {
+        ANY_FIELDS.addAll(SearchableFields.get(UserTO.class));
+        ANY_FIELDS.addAll(SearchableFields.get(GroupTO.class));
+        ANY_FIELDS.addAll(SearchableFields.get(AnyObjectTO.class));
+    }
+
+    public static boolean contains(final String schema) {
+        return ANY_FIELDS.contains(schema);
+    }
+
     public static List<String> get(final AnyTypeKind anyTypeKind) {
         return get(anyTypeKind.getToClass());
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingItemTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingItemTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingItemTO.java
index 696941d..c078950 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingItemTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingItemTO.java
@@ -26,7 +26,6 @@ import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
 import org.apache.syncope.common.lib.AbstractBaseBean;
-import org.apache.syncope.common.lib.types.IntMappingType;
 import org.apache.syncope.common.lib.types.MappingPurpose;
 
 @XmlRootElement(name = "mappingItem")
@@ -44,11 +43,6 @@ public class MappingItemTO extends AbstractBaseBean implements EntityTO {
     private String intAttrName;
 
     /**
-     * Schema type to be mapped.
-     */
-    private IntMappingType intMappingType;
-
-    /**
      * External resource's field to be mapped.
      */
     private String extAttrName;
@@ -135,14 +129,6 @@ public class MappingItemTO extends AbstractBaseBean implements EntityTO {
         this.intAttrName = intAttrName;
     }
 
-    public IntMappingType getIntMappingType() {
-        return intMappingType;
-    }
-
-    public void setIntMappingType(final IntMappingType intMappingType) {
-        this.intMappingType = intMappingType;
-    }
-
     public MappingPurpose getPurpose() {
         return purpose;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java
index e69cb95..a9048c7 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java
@@ -28,7 +28,6 @@ import javax.xml.bind.annotation.XmlType;
 import org.apache.commons.collections4.IterableUtils;
 import org.apache.commons.collections4.Predicate;
 import org.apache.syncope.common.lib.AbstractBaseBean;
-import org.apache.syncope.common.lib.types.IntMappingType;
 
 @XmlRootElement(name = "mapping")
 @XmlType
@@ -61,17 +60,6 @@ public class MappingTO extends AbstractBaseBean {
     }
 
     protected boolean addConnObjectKeyItem(final MappingItemTO connObjectItem) {
-        if (IntMappingType.UserVirtualSchema == connObjectItem.getIntMappingType()
-                || IntMappingType.GroupVirtualSchema == connObjectItem.getIntMappingType()
-                || IntMappingType.AnyObjectVirtualSchema == connObjectItem.getIntMappingType()
-                || IntMappingType.Password == connObjectItem.getIntMappingType()) {
-
-            throw new IllegalArgumentException("Virtual attributes cannot be set as connObjectKey");
-        }
-        if (IntMappingType.Password == connObjectItem.getIntMappingType()) {
-            throw new IllegalArgumentException("Password attributes cannot be set as connObjectKey");
-        }
-
         connObjectItem.setMandatoryCondition("true");
         connObjectItem.setConnObjectKey(true);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java
index 6f4a73c..428efde 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java
@@ -32,7 +32,6 @@ import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.apache.syncope.common.lib.AbstractBaseBean;
 import org.apache.syncope.common.lib.jaxb.XmlGenericMapAdapter;
-import org.apache.syncope.common.lib.types.IntMappingType;
 import org.apache.syncope.common.lib.types.TraceLevel;
 
 @XmlRootElement(name = "notification")
@@ -53,8 +52,6 @@ public class NotificationTO extends AbstractBaseBean implements EntityTO {
 
     private final List<String> staticRecipients = new ArrayList<>();
 
-    private IntMappingType recipientAttrType;
-
     private String recipientAttrName;
 
     private boolean selfAsRecipient;
@@ -117,14 +114,6 @@ public class NotificationTO extends AbstractBaseBean implements EntityTO {
         this.recipientAttrName = recipientAttrName;
     }
 
-    public IntMappingType getRecipientAttrType() {
-        return recipientAttrType;
-    }
-
-    public void setRecipientAttrType(final IntMappingType recipientAttrType) {
-        this.recipientAttrType = recipientAttrType;
-    }
-
     public boolean isSelfAsRecipient() {
         return selfAsRecipient;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
index db3e329..149cc81 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
@@ -29,7 +29,7 @@ public enum EntityViolationType {
     InvalidConnInstanceLocation("org.apache.syncope.core.persistence.validation.conninstance.location"),
     InvalidConnPoolConf("org.apache.syncope.core.persistence.validation.conninstance.poolConf"),
     InvalidMapping("org.apache.syncope.core.persistence.validation.mapping"),
-    InvalidName("org.apache.syncope.core.persistence.validation.name"),
+    InvalidKey("org.apache.syncope.core.persistence.validation.key"),
     InvalidNotification("org.apache.syncope.core.persistence.validation.notification"),
     InvalidPassword("org.apache.syncope.core.persistence.validation.user.password"),
     InvalidPolicy("org.apache.syncope.core.persistence.validation.policy"),

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java
deleted file mode 100644
index 8553348..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java
+++ /dev/null
@@ -1,203 +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.common.lib.types;
-
-import java.util.Collection;
-import java.util.EnumSet;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.xml.bind.annotation.XmlEnum;
-
-/**
- * Internal attribute mapping type.
- */
-@XmlEnum
-public enum IntMappingType {
-
-    // Unfortunately enum type cannot be extended ...
-    // -------------------------
-    // User attribute types (the same in UserMappingType)
-    // -------------------------
-    UserPlainSchema(AnyTypeKind.USER),
-    UserDerivedSchema(AnyTypeKind.USER),
-    UserVirtualSchema(AnyTypeKind.USER),
-    UserKey(AnyTypeKind.USER),
-    Username(AnyTypeKind.USER),
-    Password(AnyTypeKind.USER),
-    // -------------------------
-    // Group attribute types (the same in GroupMappingType)
-    // -------------------------
-    GroupPlainSchema(AnyTypeKind.GROUP),
-    GroupDerivedSchema(AnyTypeKind.GROUP),
-    GroupVirtualSchema(AnyTypeKind.GROUP),
-    GroupKey(AnyTypeKind.GROUP),
-    GroupName(AnyTypeKind.GROUP),
-    GroupOwnerSchema(AnyTypeKind.GROUP),
-    // -------------------------
-    // Any attribute types (the same in AnyMappingType)
-    // -------------------------
-    AnyObjectPlainSchema(AnyTypeKind.ANY_OBJECT),
-    AnyObjectDerivedSchema(AnyTypeKind.ANY_OBJECT),
-    AnyObjectVirtualSchema(AnyTypeKind.ANY_OBJECT),
-    AnyObjectKey(AnyTypeKind.ANY_OBJECT),
-    AnyObjectName(AnyTypeKind.ANY_OBJECT);
-
-    private final AnyTypeKind anyTypeKind;
-
-    IntMappingType(final AnyTypeKind anyTypeKind) {
-        this.anyTypeKind = anyTypeKind;
-    }
-
-    public AnyTypeKind getAnyTypeKind() {
-        return anyTypeKind;
-    }
-
-    /**
-     * Get attribute types for a certain any object type.
-     *
-     * @param anyTypeKind any object type
-     * @param toBeFiltered types to be filtered from the result.
-     * @return set of attribute types.
-     */
-    public static Set<IntMappingType> getAttributeTypes(
-            final AnyTypeKind anyTypeKind, final Collection<IntMappingType> toBeFiltered) {
-
-        final Set<IntMappingType> res = getAttributeTypes(anyTypeKind);
-        res.removeAll(toBeFiltered);
-
-        return res;
-    }
-
-    /**
-     * Get attribute types for a certain any object type.
-     *
-     * @param anyTypeKind any object type
-     * @return set of attribute types.
-     */
-    public static Set<IntMappingType> getAttributeTypes(final AnyTypeKind anyTypeKind) {
-        EnumSet<?> enumset;
-
-        switch (anyTypeKind) {
-            case GROUP:
-                enumset = EnumSet.allOf(GroupMappingType.class);
-                break;
-
-            case ANY_OBJECT:
-                enumset = EnumSet.allOf(AnyMappingType.class);
-                break;
-
-            case USER:
-            default:
-                enumset = EnumSet.allOf(UserMappingType.class);
-                break;
-        }
-
-        final Set<IntMappingType> result = new HashSet<>(enumset.size());
-        for (Object obj : enumset) {
-            result.add(IntMappingType.valueOf(obj.toString()));
-        }
-
-        return result;
-    }
-
-    public static Set<IntMappingType> getEmbedded() {
-        return EnumSet.of(IntMappingType.UserKey, IntMappingType.Username, IntMappingType.Password,
-                IntMappingType.GroupKey, IntMappingType.GroupName, IntMappingType.GroupOwnerSchema,
-                IntMappingType.AnyObjectKey, IntMappingType.AnyObjectName);
-    }
-
-    /**
-     * Check if attribute type belongs to the specified any object type set.
-     *
-     * @param anyTypeKind any object type.
-     * @param type attribute type.
-     * @return true if attribute type belongs to the specified any object type set.
-     */
-    public static boolean contains(final AnyTypeKind anyTypeKind, final String type) {
-        switch (anyTypeKind) {
-            case GROUP:
-                for (GroupMappingType c : GroupMappingType.values()) {
-                    if (c.name().equals(type)) {
-                        return true;
-                    }
-                }
-                break;
-
-            case ANY_OBJECT:
-                for (AnyMappingType c : AnyMappingType.values()) {
-                    if (c.name().equals(type)) {
-                        return true;
-                    }
-                }
-                break;
-
-            case USER:
-            default:
-                for (UserMappingType c : UserMappingType.values()) {
-                    if (c.name().equals(type)) {
-                        return true;
-                    }
-                }
-                break;
-        }
-        return false;
-    }
-
-    /**
-     * User attribute types.
-     */
-    private enum UserMappingType {
-
-        UserPlainSchema,
-        UserDerivedSchema,
-        UserVirtualSchema,
-        UserKey,
-        Username,
-        Password;
-
-    }
-
-    /**
-     * Group attribute types.
-     */
-    private enum GroupMappingType {
-
-        GroupPlainSchema,
-        GroupDerivedSchema,
-        GroupVirtualSchema,
-        GroupKey,
-        GroupName,
-        GroupOwnerSchema;
-
-    }
-
-    /**
-     * Any attribute types.
-     */
-    private enum AnyMappingType {
-
-        AnyObjectPlainSchema,
-        AnyObjectDerivedSchema,
-        AnyObjectVirtualSchema,
-        AnyObjectKey,
-        AnyObjectName;
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java
index 51dd04b..6afa771 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java
@@ -19,7 +19,6 @@
 package org.apache.syncope.core.persistence.api.dao;
 
 import java.util.List;
-import org.apache.syncope.common.lib.types.IntMappingType;
 import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
 import org.apache.syncope.core.persistence.api.entity.Policy;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
@@ -43,7 +42,7 @@ public interface ExternalResourceDAO extends DAO<ExternalResource> {
 
     ExternalResource save(ExternalResource resource);
 
-    void deleteMapping(String schemaName, IntMappingType intMappingType);
+    void deleteMapping(String schemaName);
 
     void delete(String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AnyUtils.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AnyUtils.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AnyUtils.java
index 0e0c8cc..84812b2 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AnyUtils.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AnyUtils.java
@@ -21,7 +21,6 @@ package org.apache.syncope.core.persistence.api.entity;
 import java.util.Set;
 import org.apache.syncope.common.lib.to.AnyTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.common.lib.types.IntMappingType;
 import org.apache.syncope.core.persistence.api.dao.AllowedSchemas;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 
@@ -31,6 +30,8 @@ public interface AnyUtils {
 
     <T extends Any<?>> Class<T> anyClass();
 
+    boolean isFieldName(String name);
+
     <T extends PlainAttr<?>> Class<T> plainAttrClass();
 
     <T extends PlainAttr<?>> T newPlainAttr();
@@ -43,12 +44,6 @@ public interface AnyUtils {
 
     <T extends PlainAttrValue> T newPlainAttrUniqueValue();
 
-    IntMappingType plainIntMappingType();
-
-    IntMappingType derIntMappingType();
-
-    IntMappingType virIntMappingType();
-
     <T extends AnyTO> T newAnyTO();
 
     Set<ExternalResource> getAllResources(Any<?> any);

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/LinkingMappingItem.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/LinkingMappingItem.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/LinkingMappingItem.java
index 6fb320f..8b2cc2d 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/LinkingMappingItem.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/LinkingMappingItem.java
@@ -20,7 +20,6 @@ package org.apache.syncope.core.persistence.api.entity;
 
 import java.util.Collections;
 import java.util.List;
-import org.apache.syncope.common.lib.types.IntMappingType;
 import org.apache.syncope.common.lib.types.MappingPurpose;
 import org.apache.syncope.core.persistence.api.entity.resource.Mapping;
 import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
@@ -74,26 +73,6 @@ public class LinkingMappingItem implements MappingItem {
     }
 
     @Override
-    public IntMappingType getIntMappingType() {
-        switch (virSchema.getProvision().getAnyType().getKind()) {
-            case ANY_OBJECT:
-                return IntMappingType.AnyObjectVirtualSchema;
-
-            case GROUP:
-                return IntMappingType.GroupVirtualSchema;
-
-            case USER:
-            default:
-                return IntMappingType.UserVirtualSchema;
-        }
-    }
-
-    @Override
-    public void setIntMappingType(final IntMappingType intMappingType) {
-        // RO instance, nothing to do
-    }
-
-    @Override
     public String getMandatoryCondition() {
         return virSchema.getMandatoryCondition();
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Notification.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Notification.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Notification.java
index 38a053f..9046ccf 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Notification.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Notification.java
@@ -19,7 +19,6 @@
 package org.apache.syncope.core.persistence.api.entity;
 
 import java.util.List;
-import org.apache.syncope.common.lib.types.IntMappingType;
 import org.apache.syncope.common.lib.types.TraceLevel;
 
 public interface Notification extends Entity {
@@ -36,10 +35,6 @@ public interface Notification extends Entity {
 
     void setRecipientAttrName(String recipientAttrName);
 
-    IntMappingType getRecipientAttrType();
-
-    void setRecipientAttrType(IntMappingType recipientAttrType);
-
     String getRecipientsFIQL();
 
     void setRecipientsFIQL(String recipientsFIQL);

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/MappingItem.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/MappingItem.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/MappingItem.java
index af751e2..461eaa1 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/MappingItem.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/MappingItem.java
@@ -19,7 +19,6 @@
 package org.apache.syncope.core.persistence.api.entity.resource;
 
 import java.util.List;
-import org.apache.syncope.common.lib.types.IntMappingType;
 import org.apache.syncope.common.lib.types.MappingPurpose;
 import org.apache.syncope.core.persistence.api.entity.Entity;
 
@@ -37,10 +36,6 @@ public interface MappingItem extends Entity {
 
     void setIntAttrName(String intAttrName);
 
-    IntMappingType getIntMappingType();
-
-    void setIntMappingType(IntMappingType intMappingType);
-
     String getMandatoryCondition();
 
     void setMandatoryCondition(String condition);

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java
index d5c7bcc..ead74ac 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java
@@ -25,7 +25,7 @@ import org.apache.cxf.jaxrs.ext.search.SearchBean;
 import org.apache.cxf.jaxrs.ext.search.SearchCondition;
 import org.apache.cxf.jaxrs.ext.search.SearchUtils;
 import org.apache.cxf.jaxrs.ext.search.visitor.AbstractSearchConditionVisitor;
-import org.apache.syncope.common.lib.EntityTOUtils;
+import org.apache.syncope.common.lib.search.SearchableFields;
 import org.apache.syncope.common.lib.search.SpecialAttr;
 import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
 import org.apache.syncope.core.persistence.api.dao.search.MembershipCond;
@@ -56,7 +56,7 @@ public class SearchCondVisitor extends AbstractSearchConditionVisitor<SearchBean
     }
 
     private AttributeCond createAttributeCond(final String schema) {
-        AttributeCond attributeCond = EntityTOUtils.ANY_FIELDS.contains(schema)
+        AttributeCond attributeCond = SearchableFields.contains(schema)
                 ? new AnyCond()
                 : new AttributeCond();
         attributeCond.setSchema(schema);

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
index 3cce4b5..3894adb 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
@@ -21,13 +21,10 @@ package org.apache.syncope.core.persistence.jpa.dao;
 import java.util.Collection;
 import java.util.List;
 import javax.persistence.TypedQuery;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.core.persistence.api.dao.DerSchemaDAO;
 import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
 import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
-import org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory;
 import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.jpa.entity.JPAAnyUtilsFactory;
 import org.apache.syncope.core.persistence.jpa.entity.JPADerSchema;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Repository;
@@ -77,10 +74,7 @@ public class JPADerSchemaDAO extends AbstractDAO<DerSchema> implements DerSchema
             return;
         }
 
-        AnyUtilsFactory anyUtilsFactory = new JPAAnyUtilsFactory();
-        for (AnyTypeKind anyTypeKind : AnyTypeKind.values()) {
-            resourceDAO.deleteMapping(key, anyUtilsFactory.getInstance(anyTypeKind).derIntMappingType());
-        }
+        resourceDAO.deleteMapping(key);
 
         if (schema.getAnyTypeClass() != null) {
             schema.getAnyTypeClass().getDerSchemas().remove(schema);

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
index 9692782..0658179 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
@@ -23,7 +23,6 @@ import java.util.List;
 import java.util.Set;
 import javax.persistence.Query;
 import javax.persistence.TypedQuery;
-import org.apache.syncope.common.lib.types.IntMappingType;
 import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
 import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
@@ -160,16 +159,11 @@ public class JPAExternalResourceDAO extends AbstractDAO<ExternalResource> implem
 
     @Override
     @SuppressWarnings("unchecked")
-    public void deleteMapping(final String intAttrName, final IntMappingType intMappingType) {
-        if (IntMappingType.getEmbedded().contains(intMappingType)) {
-            return;
-        }
-
+    public void deleteMapping(final String intAttrName) {
         TypedQuery<MappingItem> query = entityManager().createQuery(
                 "SELECT m FROM " + JPAMappingItem.class.getSimpleName()
-                + " m WHERE m.intAttrName=:intAttrName AND m.intMappingType=:intMappingType", MappingItem.class);
+                + " m WHERE m.intAttrName=:intAttrName", MappingItem.class);
         query.setParameter("intAttrName", intAttrName);
-        query.setParameter("intMappingType", intMappingType);
 
         Set<String> itemKeys = new HashSet<>();
         for (MappingItem item : query.getResultList()) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
index 1b88c82..2e3bef5 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
@@ -101,7 +101,7 @@ public class JPAPlainSchemaDAO extends AbstractDAO<PlainSchema> implements Plain
                 plainAttrDAO.delete(attr.getKey(), anyUtils.plainAttrClass());
             }
 
-            resourceDAO.deleteMapping(key, anyUtils.plainIntMappingType());
+            resourceDAO.deleteMapping(key);
         }
 
         if (schema.getAnyTypeClass() != null) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/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 61db7b3..4636f7d 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
@@ -23,17 +23,13 @@ import java.util.Collection;
 import java.util.List;
 import javax.persistence.Query;
 import javax.persistence.TypedQuery;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
 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.VirSchema;
 import org.apache.syncope.core.persistence.api.entity.resource.Provision;
 import org.apache.syncope.core.persistence.jpa.entity.JPAAnyType;
 import org.apache.syncope.core.persistence.jpa.entity.JPAAnyTypeClass;
-import org.apache.syncope.core.persistence.jpa.entity.JPAAnyUtilsFactory;
 import org.apache.syncope.core.persistence.jpa.entity.JPAConnInstance;
 import org.apache.syncope.core.persistence.jpa.entity.JPAVirSchema;
 import org.apache.syncope.core.persistence.jpa.entity.policy.JPAAccountPolicy;
@@ -122,12 +118,7 @@ public class JPAVirSchemaDAO extends AbstractDAO<VirSchema> implements VirSchema
             return;
         }
 
-        AnyUtilsFactory anyUtilsFactory = new JPAAnyUtilsFactory();
-        for (AnyTypeKind anyTypeKind : AnyTypeKind.values()) {
-            AnyUtils anyUtils = anyUtilsFactory.getInstance(anyTypeKind);
-
-            resourceDAO.deleteMapping(key, anyUtils.virIntMappingType());
-        }
+        resourceDAO.deleteMapping(key);
 
         if (schema.getAnyTypeClass() != null) {
             schema.getAnyTypeClass().getVirSchemas().remove(schema);

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSchema.java
new file mode 100644
index 0000000..81c972b
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSchema.java
@@ -0,0 +1,40 @@
+/*
+ * 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 javax.persistence.Cacheable;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.Schema;
+import org.apache.syncope.core.persistence.jpa.validation.entity.SchemaKeyCheck;
+
+@Entity
+@Inheritance(strategy = InheritanceType.JOINED)
+@Table(name = AbstractSchema.TABLE)
+@Cacheable
+@SchemaKeyCheck
+public abstract class AbstractSchema extends AbstractProvidedKeyEntity implements Schema {
+
+    public static final String TABLE = "SyncopeSchema";
+
+    private static final long serialVersionUID = -9222344997225831269L;
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/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 5c1b203..b13b19d 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,14 +18,18 @@
  */
 package org.apache.syncope.core.persistence.jpa.entity;
 
+import java.lang.reflect.Field;
+import java.util.Collection;
 import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
 import java.util.Set;
+import org.apache.commons.lang3.ClassUtils;
 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.AllowedSchemas;
 import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
 import org.apache.syncope.core.persistence.api.dao.GroupDAO;
@@ -57,6 +61,40 @@ import org.springframework.transaction.annotation.Transactional;
 @SuppressWarnings({ "unchecked", "rawtypes" })
 public class JPAAnyUtils implements AnyUtils {
 
+    private static final Set<String> USER_FIELD_NAMES = new HashSet<>();
+
+    private static final Set<String> GROUP_FIELD_NAMES = new HashSet<>();
+
+    private static final Set<String> ANY_OBJECT_FIELD_NAMES = new HashSet<>();
+
+    static {
+        initFieldNames(JPAUser.class, USER_FIELD_NAMES);
+        initFieldNames(JPAGroup.class, GROUP_FIELD_NAMES);
+        initFieldNames(JPAAnyObject.class, ANY_OBJECT_FIELD_NAMES);
+    }
+
+    private static void initFieldNames(final Class<?> entityClass, final Set<String> keys) {
+        List<Class<?>> classes = ClassUtils.getAllSuperclasses(entityClass);
+        if (!classes.contains(JPAUser.class)) {
+            classes.add(JPAUser.class);
+        }
+        for (Class<?> clazz : classes) {
+            for (Field field : clazz.getDeclaredFields()) {
+                if (!Collection.class.isAssignableFrom(field.getType())
+                        && !Map.class.isAssignableFrom(field.getType())) {
+
+                    keys.add(field.getName());
+                }
+            }
+        }
+    }
+
+    public static boolean matchesFieldName(final String candidate) {
+        return USER_FIELD_NAMES.contains(candidate)
+                || GROUP_FIELD_NAMES.contains(candidate)
+                || ANY_OBJECT_FIELD_NAMES.contains(candidate);
+    }
+
     private final AnyTypeKind anyTypeKind;
 
     @Autowired
@@ -99,6 +137,28 @@ public class JPAAnyUtils implements AnyUtils {
     }
 
     @Override
+    public boolean isFieldName(final String name) {
+        Set<String> names;
+
+        switch (anyTypeKind) {
+            case GROUP:
+                names = GROUP_FIELD_NAMES;
+                break;
+
+            case ANY_OBJECT:
+                names = ANY_OBJECT_FIELD_NAMES;
+                break;
+
+            case USER:
+            default:
+                names = USER_FIELD_NAMES;
+                break;
+        }
+
+        return names.contains(name);
+    }
+
+    @Override
     public <T extends PlainAttr<?>> Class<T> plainAttrClass() {
         Class result;
 
@@ -234,75 +294,6 @@ public class JPAAnyUtils implements AnyUtils {
     }
 
     @Override
-    public IntMappingType plainIntMappingType() {
-        IntMappingType result = null;
-
-        switch (anyTypeKind) {
-            case GROUP:
-                result = IntMappingType.GroupPlainSchema;
-                break;
-
-            case ANY_OBJECT:
-                result = IntMappingType.AnyObjectPlainSchema;
-                break;
-
-            case USER:
-                result = IntMappingType.UserPlainSchema;
-                break;
-
-            default:
-        }
-
-        return result;
-    }
-
-    @Override
-    public IntMappingType derIntMappingType() {
-        IntMappingType result = null;
-
-        switch (anyTypeKind) {
-            case GROUP:
-                result = IntMappingType.GroupDerivedSchema;
-                break;
-
-            case ANY_OBJECT:
-                result = IntMappingType.AnyObjectDerivedSchema;
-                break;
-
-            case USER:
-                result = IntMappingType.UserDerivedSchema;
-                break;
-
-            default:
-        }
-
-        return result;
-    }
-
-    @Override
-    public IntMappingType virIntMappingType() {
-        IntMappingType result = null;
-
-        switch (anyTypeKind) {
-            case GROUP:
-                result = IntMappingType.GroupVirtualSchema;
-                break;
-
-            case ANY_OBJECT:
-                result = IntMappingType.AnyObjectVirtualSchema;
-                break;
-
-            case USER:
-                result = IntMappingType.UserVirtualSchema;
-                break;
-
-            default:
-        }
-
-        return result;
-    }
-
-    @Override
     public <T extends AnyTO> T newAnyTO() {
         T result = null;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPADerSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPADerSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPADerSchema.java
index 7270093..e01fc99 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPADerSchema.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPADerSchema.java
@@ -18,22 +18,20 @@
  */
 package org.apache.syncope.core.persistence.jpa.entity;
 
-import javax.persistence.Cacheable;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
 import javax.persistence.OneToOne;
+import javax.persistence.PrimaryKeyJoinColumn;
 import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 import org.apache.syncope.common.lib.types.AttrSchemaType;
 import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
 import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.jpa.validation.entity.SchemaKeyCheck;
 
 @Entity
 @Table(name = JPADerSchema.TABLE)
-@Cacheable
-@SchemaKeyCheck
-public class JPADerSchema extends AbstractProvidedKeyEntity implements DerSchema {
+@PrimaryKeyJoinColumn(name = "id", referencedColumnName = "id")
+public class JPADerSchema extends AbstractSchema implements DerSchema {
 
     private static final long serialVersionUID = -6173643493348674060L;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java
index 7d186cd..392c8af 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPANotification.java
@@ -38,7 +38,6 @@ import javax.validation.constraints.Min;
 import javax.validation.constraints.NotNull;
 import org.apache.commons.collections4.IterableUtils;
 import org.apache.commons.collections4.Predicate;
-import org.apache.syncope.common.lib.types.IntMappingType;
 import org.apache.syncope.common.lib.types.TraceLevel;
 import org.apache.syncope.core.persistence.api.entity.AnyAbout;
 import org.apache.syncope.core.persistence.api.entity.AnyType;
@@ -75,10 +74,6 @@ public class JPANotification extends AbstractGeneratedKeyEntity implements Notif
     private List<String> staticRecipients;
 
     @NotNull
-    @Enumerated(EnumType.STRING)
-    private IntMappingType recipientAttrType;
-
-    @NotNull
     private String recipientAttrName;
 
     private String recipientsProviderClassName;
@@ -139,16 +134,6 @@ public class JPANotification extends AbstractGeneratedKeyEntity implements Notif
     }
 
     @Override
-    public IntMappingType getRecipientAttrType() {
-        return recipientAttrType;
-    }
-
-    @Override
-    public void setRecipientAttrType(final IntMappingType recipientAttrType) {
-        this.recipientAttrType = recipientAttrType;
-    }
-
-    @Override
     public String getRecipientsProviderClassName() {
         return recipientsProviderClassName;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAPlainSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAPlainSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAPlainSchema.java
index 02b3ff7..4515517 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAPlainSchema.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAPlainSchema.java
@@ -27,6 +27,7 @@ import javax.persistence.Enumerated;
 import javax.persistence.FetchType;
 import javax.persistence.Lob;
 import javax.persistence.OneToOne;
+import javax.persistence.PrimaryKeyJoinColumn;
 import javax.persistence.Table;
 import javax.persistence.Transient;
 import javax.validation.constraints.Max;
@@ -40,13 +41,12 @@ import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
 import org.apache.syncope.core.persistence.api.entity.PlainSchema;
 import org.apache.syncope.core.persistence.jpa.attrvalue.validation.BasicValidator;
 import org.apache.syncope.core.persistence.jpa.validation.entity.PlainSchemaCheck;
-import org.apache.syncope.core.persistence.jpa.validation.entity.SchemaKeyCheck;
 
 @Entity
 @Table(name = JPAPlainSchema.TABLE)
+@PrimaryKeyJoinColumn(name = "id", referencedColumnName = "id")
 @PlainSchemaCheck
-@SchemaKeyCheck
-public class JPAPlainSchema extends AbstractProvidedKeyEntity implements PlainSchema {
+public class JPAPlainSchema extends AbstractSchema implements PlainSchema {
 
     private static final long serialVersionUID = -8621028596062054739L;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAVirSchema.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAVirSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAVirSchema.java
index 8cf70ff..1325ca7 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAVirSchema.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAVirSchema.java
@@ -19,11 +19,11 @@
 package org.apache.syncope.core.persistence.jpa.entity;
 
 import javax.persistence.Basic;
-import javax.persistence.Cacheable;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
 import javax.persistence.ManyToOne;
 import javax.persistence.OneToOne;
+import javax.persistence.PrimaryKeyJoinColumn;
 import javax.persistence.Table;
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
@@ -35,13 +35,11 @@ import org.apache.syncope.core.persistence.api.entity.VirSchema;
 import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
 import org.apache.syncope.core.persistence.api.entity.resource.Provision;
 import org.apache.syncope.core.persistence.jpa.entity.resource.JPAProvision;
-import org.apache.syncope.core.persistence.jpa.validation.entity.SchemaKeyCheck;
 
 @Entity
 @Table(name = JPAVirSchema.TABLE)
-@Cacheable
-@SchemaKeyCheck
-public class JPAVirSchema extends AbstractProvidedKeyEntity implements VirSchema {
+@PrimaryKeyJoinColumn(name = "id", referencedColumnName = "id")
+public class JPAVirSchema extends AbstractSchema implements VirSchema {
 
     private static final long serialVersionUID = 3274006935328590141L;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAAPlainAttrValue.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAAPlainAttrValue.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAAPlainAttrValue.java
index d7048fa..ee11d59 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAAPlainAttrValue.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/anyobject/JPAAPlainAttrValue.java
@@ -19,8 +19,6 @@
 package org.apache.syncope.core.persistence.jpa.entity.anyobject;
 
 import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
 import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
@@ -31,7 +29,6 @@ import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue;
 
 @Entity
 @Table(name = JPAAPlainAttrValue.TABLE)
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
 public class JPAAPlainAttrValue extends AbstractPlainAttrValue implements APlainAttrValue {
 
     private static final long serialVersionUID = -2965487882824889272L;

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/conf/JPACPlainAttrValue.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/conf/JPACPlainAttrValue.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/conf/JPACPlainAttrValue.java
index ac72983..f4cbbca 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/conf/JPACPlainAttrValue.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/conf/JPACPlainAttrValue.java
@@ -19,8 +19,6 @@
 package org.apache.syncope.core.persistence.jpa.entity.conf;
 
 import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
 import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
@@ -31,7 +29,6 @@ import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue;
 
 @Entity
 @Table(name = JPACPlainAttrValue.TABLE)
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
 public class JPACPlainAttrValue extends AbstractPlainAttrValue implements CPlainAttrValue {
 
     private static final long serialVersionUID = -4029895248193486171L;

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrValue.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrValue.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrValue.java
index 8c9f383..bf2cd6f 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrValue.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrValue.java
@@ -19,8 +19,6 @@
 package org.apache.syncope.core.persistence.jpa.entity.group;
 
 import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
 import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
@@ -31,7 +29,6 @@ import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue;
 
 @Entity
 @Table(name = JPAGPlainAttrValue.TABLE)
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
 public class JPAGPlainAttrValue extends AbstractPlainAttrValue implements GPlainAttrValue {
 
     private static final long serialVersionUID = -766808291128424707L;

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/resource/JPAMapping.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/resource/JPAMapping.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/resource/JPAMapping.java
index 0bd2440..3894994 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/resource/JPAMapping.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/resource/JPAMapping.java
@@ -30,7 +30,6 @@ import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 import org.apache.commons.collections4.IterableUtils;
 import org.apache.commons.collections4.Predicate;
-import org.apache.syncope.common.lib.types.IntMappingType;
 import org.apache.syncope.core.persistence.api.entity.resource.Mapping;
 import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
 import org.apache.syncope.core.persistence.api.entity.resource.Provision;
@@ -92,26 +91,8 @@ public class JPAMapping extends AbstractGeneratedKeyEntity implements Mapping {
 
     @Override
     public void setConnObjectKeyItem(final MappingItem item) {
-        checkType(item, JPAMappingItem.class);
-        this.addConnObjectKeyItem((JPAMappingItem) item);
-    }
-
-    protected boolean addConnObjectKeyItem(final MappingItem connObjectKeyItem) {
-        if (IntMappingType.UserVirtualSchema == connObjectKeyItem.getIntMappingType()
-                || IntMappingType.GroupVirtualSchema == connObjectKeyItem.getIntMappingType()
-                || IntMappingType.AnyObjectVirtualSchema == connObjectKeyItem.getIntMappingType()
-                || IntMappingType.Password == connObjectKeyItem.getIntMappingType()) {
-
-            throw new IllegalArgumentException("Virtual attributes cannot be set as ConnObjectKey");
-        }
-        if (IntMappingType.Password == connObjectKeyItem.getIntMappingType()) {
-            throw new IllegalArgumentException("Password attributes cannot be set as ConnObjectKey");
-        }
-
-        connObjectKeyItem.setExtAttrName(connObjectKeyItem.getExtAttrName());
-        connObjectKeyItem.setConnObjectKey(true);
-
-        return this.add(connObjectKeyItem);
+        item.setConnObjectKey(true);
+        this.add(item);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/resource/JPAMappingItem.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/resource/JPAMappingItem.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/resource/JPAMappingItem.java
index 1d00f89..7c89dec 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/resource/JPAMappingItem.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/resource/JPAMappingItem.java
@@ -35,7 +35,6 @@ import javax.persistence.Table;
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
 import javax.validation.constraints.NotNull;
-import org.apache.syncope.common.lib.types.IntMappingType;
 import org.apache.syncope.common.lib.types.MappingPurpose;
 import org.apache.syncope.core.persistence.api.entity.resource.Mapping;
 import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
@@ -56,10 +55,6 @@ public class JPAMappingItem extends AbstractGeneratedKeyEntity implements Mappin
     @Column(nullable = true)
     private String intAttrName;
 
-    @NotNull
-    @Enumerated(EnumType.STRING)
-    private IntMappingType intMappingType;
-
     /**
      * Target resource's field to be mapped.
      */
@@ -158,40 +153,7 @@ public class JPAMappingItem extends AbstractGeneratedKeyEntity implements Mappin
 
     @Override
     public String getIntAttrName() {
-        final String name;
-
-        switch (getIntMappingType()) {
-            case UserKey:
-            case GroupKey:
-            case AnyObjectKey:
-                name = "id";
-                break;
-
-            case Username:
-                name = "username";
-                break;
-
-            case Password:
-                name = "password";
-                break;
-
-            case GroupName:
-                name = "groupName";
-                break;
-
-            case GroupOwnerSchema:
-                name = "groupOwnerSchema";
-                break;
-
-            case AnyObjectName:
-                name = "anyObjectName";
-                break;
-                
-            default:
-                name = intAttrName;
-        }
-
-        return name;
+        return intAttrName;
     }
 
     @Override
@@ -200,16 +162,6 @@ public class JPAMappingItem extends AbstractGeneratedKeyEntity implements Mappin
     }
 
     @Override
-    public IntMappingType getIntMappingType() {
-        return intMappingType;
-    }
-
-    @Override
-    public void setIntMappingType(final IntMappingType intMappingType) {
-        this.intMappingType = intMappingType;
-    }
-
-    @Override
     public boolean isConnObjectKey() {
         return isBooleanAsInteger(connObjectKey);
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUPlainAttrValue.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUPlainAttrValue.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUPlainAttrValue.java
index ce1607a..99ea4ee 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUPlainAttrValue.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUPlainAttrValue.java
@@ -19,8 +19,6 @@
 package org.apache.syncope.core.persistence.jpa.entity.user;
 
 import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
 import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
@@ -31,7 +29,6 @@ import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue;
 
 @Entity
 @Table(name = JPAUPlainAttrValue.TABLE)
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
 public class JPAUPlainAttrValue extends AbstractPlainAttrValue implements UPlainAttrValue {
 
     private static final long serialVersionUID = -6259576015647897446L;

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/AbstractValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/AbstractValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/AbstractValidator.java
index f1a70dc..5eeae0d 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/AbstractValidator.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/AbstractValidator.java
@@ -29,7 +29,7 @@ public abstract class AbstractValidator<A extends Annotation, T> implements Cons
 
     protected static final Logger LOG = LoggerFactory.getLogger(AbstractValidator.class);
 
-    protected static final Pattern NAME_PATTERN =
+    protected static final Pattern KEY_PATTERN =
             Pattern.compile("^[\\w \\-@.]+", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/DomainValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/DomainValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/DomainValidator.java
index 2e585e4..2829e69 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/DomainValidator.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/DomainValidator.java
@@ -29,14 +29,14 @@ public class DomainValidator extends AbstractValidator<DomainCheck, Domain> {
     public boolean isValid(final Domain object, final ConstraintValidatorContext context) {
         context.disableDefaultConstraintViolation();
 
-        boolean isValid = !SyncopeConstants.MASTER_DOMAIN.equals(object.getKey());
-
-        if (!isValid) {
+        if (SyncopeConstants.MASTER_DOMAIN.equals(object.getKey())) {
             context.buildConstraintViolationWithTemplate(
-                    getTemplate(EntityViolationType.InvalidName, "Reserved: " + SyncopeConstants.MASTER_DOMAIN)).
-                    addPropertyNode("name").addConstraintViolation();
+                    getTemplate(EntityViolationType.InvalidKey, "Reserved: " + SyncopeConstants.MASTER_DOMAIN)).
+                    addPropertyNode("key").addConstraintViolation();
+
+            return false;
         }
 
-        return isValid;
+        return true;
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/a4afd4a2/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 7b145d4..99a8ec8 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
@@ -25,22 +25,28 @@ import org.apache.commons.collections4.IterableUtils;
 import org.apache.commons.collections4.Predicate;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.common.lib.types.IntMappingType;
 import org.apache.syncope.common.lib.types.MappingPurpose;
+import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.syncope.core.spring.ApplicationContextProvider;
 import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
 import org.apache.syncope.core.persistence.api.entity.AnyType;
+import org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory;
 import org.apache.syncope.core.persistence.api.entity.VirSchema;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 import org.apache.syncope.core.persistence.api.entity.resource.Mapping;
 import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
 import org.apache.syncope.core.persistence.api.entity.resource.Provision;
+import org.apache.syncope.core.persistence.jpa.entity.JPAAnyUtilsFactory;
+import org.apache.syncope.core.provisioning.api.IntAttrNameParser;
+import org.apache.syncope.core.provisioning.api.IntAttrNameParser.IntAttrName;
 import org.apache.syncope.core.provisioning.api.data.MappingItemTransformer;
 import org.apache.syncope.core.provisioning.api.propagation.PropagationActions;
 import org.identityconnectors.framework.common.objects.ObjectClass;
 
 public class ExternalResourceValidator extends AbstractValidator<ExternalResourceCheck, ExternalResource> {
 
+    private static final AnyUtilsFactory ANY_UTILS_FACTORY = new JPAAnyUtilsFactory();
+
     private boolean isValid(final MappingItem item, final ConstraintValidatorContext context) {
         if (StringUtils.isBlank(item.getExtAttrName())) {
             context.buildConstraintViolationWithTemplate(
@@ -50,6 +56,14 @@ public class ExternalResourceValidator extends AbstractValidator<ExternalResourc
             return false;
         }
 
+        if (item.getPurpose() == null) {
+            context.buildConstraintViolationWithTemplate(
+                    getTemplate(EntityViolationType.InvalidMapping, item + " - purpose is null")).
+                    addPropertyNode("purpose").addConstraintViolation();
+
+            return false;
+        }
+
         if (StringUtils.isBlank(item.getIntAttrName())) {
             context.buildConstraintViolationWithTemplate(
                     getTemplate(EntityViolationType.InvalidMapping, item + " - intAttrName is null")).
@@ -58,32 +72,32 @@ public class ExternalResourceValidator extends AbstractValidator<ExternalResourc
             return false;
         }
 
-        if (item.getPurpose() == null) {
+        IntAttrName intAttrName = null;
+        try {
+            intAttrName = IntAttrNameParser.parse(
+                    item.getIntAttrName(),
+                    ANY_UTILS_FACTORY,
+                    item.getMapping().getProvision().getAnyType().getKind());
+        } catch (IllegalArgumentException e) {
             context.buildConstraintViolationWithTemplate(
-                    getTemplate(EntityViolationType.InvalidMapping, item + " - purpose is null")).
-                    addPropertyNode("purpose").addConstraintViolation();
+                    getTemplate(EntityViolationType.InvalidMapping, item + " - " + e.getMessage())).
+                    addPropertyNode("intAttrName").addConstraintViolation();
 
             return false;
         }
 
-        if (item.getIntMappingType() == IntMappingType.AnyObjectDerivedSchema
-                || item.getIntMappingType() == IntMappingType.GroupDerivedSchema
-                || item.getIntMappingType() == IntMappingType.UserDerivedSchema) {
+        if (intAttrName.getSchemaType() == SchemaType.DERIVED
+                && item.getPurpose() != MappingPurpose.PROPAGATION) {
 
-            if (item.getPurpose() != MappingPurpose.PROPAGATION) {
-                context.buildConstraintViolationWithTemplate(
-                        getTemplate(EntityViolationType.InvalidMapping,
-                                " - only " + MappingPurpose.PROPAGATION.name() + " allowed for derived")).
-                        addPropertyNode("purpose").addConstraintViolation();
+            context.buildConstraintViolationWithTemplate(
+                    getTemplate(EntityViolationType.InvalidMapping,
+                            " - only " + MappingPurpose.PROPAGATION.name() + " allowed for derived")).
+                    addPropertyNode("purpose").addConstraintViolation();
 
-                return false;
-            }
+            return false;
         }
 
-        if (item.getIntMappingType() == IntMappingType.AnyObjectVirtualSchema
-                || item.getIntMappingType() == IntMappingType.GroupVirtualSchema
-                || item.getIntMappingType() == IntMappingType.UserVirtualSchema) {
-
+        if (intAttrName.getSchemaType() == SchemaType.VIRTUAL) {
             if (item.getPurpose() != MappingPurpose.PROPAGATION) {
                 context.buildConstraintViolationWithTemplate(
                         getTemplate(EntityViolationType.InvalidMapping,
@@ -136,14 +150,6 @@ public class ExternalResourceValidator extends AbstractValidator<ExternalResourc
             return false;
         }
 
-        MappingItem connObjectKey = mapping.getConnObjectKeyItem();
-        if (connObjectKey.getIntMappingType().getAnyTypeKind() != anyType.getKind()) {
-            context.buildConstraintViolationWithTemplate(
-                    getTemplate(EntityViolationType.InvalidMapping, "ConnObjectKey must be from the same AnyTypeKind")).
-                    addPropertyNode("anyTypeKind").addConstraintViolation();
-            return false;
-        }
-
         boolean isValid = true;
 
         int passwords = 0;
@@ -189,10 +195,10 @@ public class ExternalResourceValidator extends AbstractValidator<ExternalResourc
     public boolean isValid(final ExternalResource resource, final ConstraintValidatorContext context) {
         context.disableDefaultConstraintViolation();
 
-        if (resource.getKey() == null || !NAME_PATTERN.matcher(resource.getKey()).matches()) {
+        if (resource.getKey() == null || !KEY_PATTERN.matcher(resource.getKey()).matches()) {
             context.buildConstraintViolationWithTemplate(
-                    getTemplate(EntityViolationType.InvalidName, "Invalid Resource name")).
-                    addPropertyNode("name").addConstraintViolation();
+                    getTemplate(EntityViolationType.InvalidKey, "Invalid resource key")).
+                    addPropertyNode("key").addConstraintViolation();
             return false;
         }