http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/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
new file mode 100644
index 0000000..5924b16
--- /dev/null
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java
@@ -0,0 +1,593 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.persistence.Basic;
+import javax.persistence.Cacheable;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.UniqueConstraint;
+import javax.validation.Valid;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.DerSchema;
+import org.apache.syncope.core.persistence.api.entity.Entitlement;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
+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;
+import 
org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate;
+import 
org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate;
+import 
org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GDerAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GDerSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GVirAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.apache.syncope.core.persistence.jpa.validation.entity.GroupCheck;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractSubject;
+import org.apache.syncope.core.persistence.jpa.entity.JPAAccountPolicy;
+import org.apache.syncope.core.persistence.jpa.entity.JPAEntitlement;
+import org.apache.syncope.core.persistence.jpa.entity.JPAExternalResource;
+import org.apache.syncope.core.persistence.jpa.entity.JPAPasswordPolicy;
+import 
org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrTemplate;
+import 
org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttrTemplate;
+import 
org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
+
+@Entity
+@Table(name = JPAGroup.TABLE, uniqueConstraints =
+        @UniqueConstraint(columnNames = { "name", "parent_id" }))
+@Cacheable
+@GroupCheck
+public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> 
implements Group {
+
+    private static final long serialVersionUID = -5281258853142421875L;
+
+    public static final String TABLE = "SyncopeGroup";
+
+    @Id
+    private Long id;
+
+    @NotNull
+    private String name;
+
+    @ManyToOne(optional = true)
+    private JPAGroup parent;
+
+    @ManyToOne(optional = true)
+    private JPAUser userOwner;
+
+    @ManyToOne(optional = true)
+    private JPAGroup groupOwner;
+
+    @ManyToMany(fetch = FetchType.EAGER)
+    @JoinTable(joinColumns =
+            @JoinColumn(name = "group_id"),
+            inverseJoinColumns =
+            @JoinColumn(name = "entitlement_name"))
+    private Set<JPAEntitlement> entitlements;
+
+    @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+    @Valid
+    private List<JPAGPlainAttrTemplate> rAttrTemplates;
+
+    @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+    @Valid
+    private List<JPAGDerAttrTemplate> rDerAttrTemplates;
+
+    @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+    @Valid
+    private List<JPAGVirAttrTemplate> rVirAttrTemplates;
+
+    @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+    @Valid
+    private List<JPAMPlainAttrTemplate> mAttrTemplates;
+
+    @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+    @Valid
+    private List<JPAMDerAttrTemplate> mDerAttrTemplates;
+
+    @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+    @Valid
+    private List<JPAMVirAttrTemplate> mVirAttrTemplates;
+
+    @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+    @Valid
+    private List<JPAGPlainAttr> plainAttrs;
+
+    @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+    @Valid
+    private List<JPAGDerAttr> derAttrs;
+
+    @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
+    @Valid
+    private List<JPAGVirAttr> virAttrs;
+
+    @Basic(optional = true)
+    @Min(0)
+    @Max(1)
+    private Integer inheritOwner;
+
+    @Basic(optional = true)
+    @Min(0)
+    @Max(1)
+    private Integer inheritTemplates;
+
+    @Basic(optional = true)
+    @Min(0)
+    @Max(1)
+    private Integer inheritPlainAttrs;
+
+    @Basic(optional = true)
+    @Min(0)
+    @Max(1)
+    private Integer inheritDerAttrs;
+
+    @Basic(optional = true)
+    @Min(0)
+    @Max(1)
+    private Integer inheritVirAttrs;
+
+    @Basic(optional = true)
+    @Min(0)
+    @Max(1)
+    private Integer inheritPasswordPolicy;
+
+    @Basic(optional = true)
+    @Min(0)
+    @Max(1)
+    private Integer inheritAccountPolicy;
+
+    @ManyToOne(fetch = FetchType.EAGER, optional = true)
+    private JPAPasswordPolicy passwordPolicy;
+
+    @ManyToOne(fetch = FetchType.EAGER, optional = true)
+    private JPAAccountPolicy accountPolicy;
+
+    /**
+     * Provisioning external resources.
+     */
+    @ManyToMany(fetch = FetchType.EAGER)
+    @JoinTable(joinColumns =
+            @JoinColumn(name = "group_id"),
+            inverseJoinColumns =
+            @JoinColumn(name = "resource_name"))
+    @Valid
+    private Set<JPAExternalResource> resources;
+
+    public JPAGroup() {
+        super();
+
+        entitlements = new HashSet<>();
+
+        rAttrTemplates = new ArrayList<>();
+        rDerAttrTemplates = new ArrayList<>();
+        rVirAttrTemplates = new ArrayList<>();
+        mAttrTemplates = new ArrayList<>();
+        mDerAttrTemplates = new ArrayList<>();
+        mVirAttrTemplates = new ArrayList<>();
+
+        plainAttrs = new ArrayList<>();
+        derAttrs = new ArrayList<>();
+        virAttrs = new ArrayList<>();
+
+        inheritOwner = getBooleanAsInteger(false);
+        inheritTemplates = getBooleanAsInteger(false);
+        inheritPlainAttrs = getBooleanAsInteger(false);
+        inheritDerAttrs = getBooleanAsInteger(false);
+        inheritVirAttrs = getBooleanAsInteger(false);
+        inheritPasswordPolicy = getBooleanAsInteger(false);
+        inheritAccountPolicy = getBooleanAsInteger(false);
+
+        resources = new HashSet<>();
+    }
+
+    @Override
+    public Long getKey() {
+        return id;
+    }
+
+    @Override
+    protected Set<? extends ExternalResource> internalGetResources() {
+        return resources;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    @Override
+    public Group getParent() {
+        return parent;
+    }
+
+    @Override
+    public void setParent(final Group parent) {
+        checkType(parent, JPAGroup.class);
+        this.parent = (JPAGroup) parent;
+    }
+
+    @Override
+    public boolean isInheritOwner() {
+        return isBooleanAsInteger(inheritOwner);
+    }
+
+    @Override
+    public void setInheritOwner(final boolean inheritOwner) {
+        this.inheritOwner = getBooleanAsInteger(inheritOwner);
+    }
+
+    @Override
+    public User getUserOwner() {
+        return userOwner;
+    }
+
+    @Override
+    public void setUserOwner(final User userOwner) {
+        checkType(userOwner, JPAUser.class);
+        this.userOwner = (JPAUser) userOwner;
+    }
+
+    @Override
+    public JPAGroup getGroupOwner() {
+        return groupOwner;
+    }
+
+    @Override
+    public void setGroupOwner(final Group group) {
+        checkType(group, JPAGroup.class);
+        this.groupOwner = (JPAGroup) group;
+    }
+
+    @Override
+    public boolean addEntitlement(final Entitlement entitlement) {
+        checkType(entitlement, JPAEntitlement.class);
+        return entitlements.add((JPAEntitlement) entitlement);
+    }
+
+    @Override
+    public boolean removeEntitlement(final Entitlement entitlement) {
+        checkType(entitlement, JPAEntitlement.class);
+        return entitlements.remove((JPAEntitlement) entitlement);
+    }
+
+    @Override
+    public Set<? extends Entitlement> getEntitlements() {
+        return entitlements;
+    }
+
+    @Override
+    public boolean isInheritTemplates() {
+        return isBooleanAsInteger(inheritTemplates);
+    }
+
+    @Override
+    public void setInheritTemplates(final boolean inheritAttrTemplates) {
+        this.inheritTemplates = getBooleanAsInteger(inheritAttrTemplates);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public <T extends AttrTemplate<K>, K extends Schema> List<T> 
getAttrTemplates(final Class<T> reference) {
+        List<T> result = new ArrayList<>();
+
+        if (GPlainAttrTemplate.class.isAssignableFrom(reference)) {
+            result = (List<T>) rAttrTemplates;
+        } else if (GDerAttrTemplate.class.isAssignableFrom(reference)) {
+            result = (List<T>) rDerAttrTemplates;
+        } else if (GVirAttrTemplate.class.isAssignableFrom(reference)) {
+            result = (List<T>) rVirAttrTemplates;
+        } else if (MPlainAttrTemplate.class.isAssignableFrom(reference)) {
+            result = (List<T>) mAttrTemplates;
+        } else if (MDerAttrTemplate.class.isAssignableFrom(reference)) {
+            result = (List<T>) mDerAttrTemplates;
+        } else if (MVirAttrTemplate.class.isAssignableFrom(reference)) {
+            result = (List<T>) mVirAttrTemplates;
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends AttrTemplate<K>, K extends Schema> T getAttrTemplate(
+            final Class<T> reference, final String schemaName) {
+
+        T result = null;
+
+        for (T template : findInheritedTemplates(reference)) {
+            if (schemaName.equals(template.getSchema().getKey())) {
+                result = template;
+            }
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends AttrTemplate<K>, K extends Schema> List<K> 
getAttrTemplateSchemas(final Class<T> reference) {
+        final List<K> result = new ArrayList<>();
+
+        for (T template : findInheritedTemplates(reference)) {
+            result.add(template.getSchema());
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends AttrTemplate<K>, K extends Schema> List<T> 
findInheritedTemplates(final Class<T> reference) {
+        final List<T> result = new ArrayList<>(getAttrTemplates(reference));
+
+        if (isInheritTemplates() && getParent() != null) {
+            result.addAll(getParent().findInheritedTemplates(reference));
+        }
+
+        return result;
+    }
+
+    @Override
+    public boolean addPlainAttr(final GPlainAttr attr) {
+        checkType(attr, JPAGPlainAttr.class);
+        return plainAttrs.add((JPAGPlainAttr) attr);
+    }
+
+    @Override
+    public boolean removePlainAttr(final GPlainAttr attr) {
+        checkType(attr, JPAGPlainAttr.class);
+        return plainAttrs.remove((JPAGPlainAttr) attr);
+    }
+
+    @Override
+    public List<? extends GPlainAttr> getPlainAttrs() {
+        return plainAttrs;
+    }
+
+    @Override
+    public boolean addDerAttr(final GDerAttr attr) {
+        checkType(attr, JPAGDerAttr.class);
+        return derAttrs.add((JPAGDerAttr) attr);
+    }
+
+    @Override
+    public boolean removeDerAttr(final GDerAttr attr) {
+        checkType(attr, JPAGDerAttr.class);
+        return derAttrs.remove((JPAGDerAttr) attr);
+    }
+
+    @Override
+    public List<? extends GDerAttr> getDerAttrs() {
+        return derAttrs;
+    }
+
+    @Override
+    public boolean addVirAttr(final GVirAttr attr) {
+        checkType(attr, JPAGVirAttr.class);
+        return virAttrs.add((JPAGVirAttr) attr);
+    }
+
+    @Override
+    public boolean removeVirAttr(final GVirAttr attr) {
+        checkType(attr, JPAGVirAttr.class);
+        return virAttrs.remove((JPAGVirAttr) attr);
+    }
+
+    @Override
+    public List<? extends GVirAttr> getVirAttrs() {
+        return virAttrs;
+    }
+
+    @Override
+    public boolean isInheritPlainAttrs() {
+        return isBooleanAsInteger(inheritPlainAttrs);
+    }
+
+    @Override
+    public void setInheritPlainAttrs(final boolean inheritPlainAttrs) {
+        this.inheritPlainAttrs = getBooleanAsInteger(inheritPlainAttrs);
+    }
+
+    /**
+     * Get all inherited attributes from the ancestors.
+     *
+     * @return a list of inherited and only inherited attributes.
+     */
+    @Override
+    public List<? extends GPlainAttr> findLastInheritedAncestorPlainAttrs() {
+        final Map<JPAGPlainSchema, GPlainAttr> result = new HashMap<>();
+
+        if (!isInheritPlainAttrs()) {
+            return plainAttrs;
+        }
+        if (isInheritPlainAttrs() && getParent() != null) {
+            final Map<PlainSchema, GPlainAttr> attrMap = getPlainAttrMap();
+
+            // Add inherit attributes
+            for (GPlainAttr attr : 
getParent().findLastInheritedAncestorPlainAttrs()) {
+                if (attrMap.containsKey(attr.getSchema())) {
+                    result.remove((JPAGPlainSchema) attr.getSchema());
+                }
+                result.put((JPAGPlainSchema) attr.getSchema(), attr);
+            }
+        }
+        return new ArrayList<>(result.values());
+    }
+
+    @Override
+    public boolean isInheritDerAttrs() {
+        return isBooleanAsInteger(inheritDerAttrs);
+    }
+
+    @Override
+    public void setInheritDerAttrs(final boolean inheritDerAttrs) {
+        this.inheritDerAttrs = getBooleanAsInteger(inheritDerAttrs);
+
+    }
+
+    /**
+     * Get all inherited derived attributes from the ancestors.
+     *
+     * @return a list of inherited and only inherited attributes.
+     */
+    @Override
+    public List<? extends GDerAttr> findLastInheritedAncestorDerAttrs() {
+        final Map<GDerSchema, GDerAttr> result = new HashMap<>();
+
+        if (!isInheritDerAttrs()) {
+            return derAttrs;
+        }
+        if (isInheritDerAttrs() && getParent() != null) {
+            Map<DerSchema, GDerAttr> derAttrMap = getDerAttrMap();
+
+            // Add inherit derived attributes
+            for (GDerAttr attr : 
getParent().findLastInheritedAncestorDerAttrs()) {
+                if (derAttrMap.containsKey(attr.getSchema())) {
+                    result.remove(attr.getSchema());
+                }
+                result.put(attr.getSchema(), attr);
+            }
+        }
+        return new ArrayList<>(result.values());
+    }
+
+    @Override
+    public boolean isInheritVirAttrs() {
+        return isBooleanAsInteger(inheritVirAttrs);
+    }
+
+    @Override
+    public void setInheritVirAttrs(final boolean inheritVirAttrs) {
+        this.inheritVirAttrs = getBooleanAsInteger(inheritVirAttrs);
+
+    }
+
+    /**
+     * Get all inherited virtual attributes from the ancestors.
+     *
+     * @return a list of inherited and only inherited attributes.
+     */
+    @Override
+    public List<? extends GVirAttr> findLastInheritedAncestorVirAttrs() {
+        final Map<GVirSchema, GVirAttr> result = new HashMap<>();
+
+        if (!isInheritVirAttrs()) {
+            return virAttrs;
+        }
+
+        if (isInheritVirAttrs() && getParent() != null) {
+            Map<VirSchema, GVirAttr> virAttrMap = getVirAttrMap();
+
+            // Add inherit virtual attributes
+            for (GVirAttr attr : 
getParent().findLastInheritedAncestorVirAttrs()) {
+                if (virAttrMap.containsKey(attr.getSchema())) {
+                    result.remove(attr.getSchema());
+                }
+                result.put(attr.getSchema(), attr);
+            }
+        }
+        return new ArrayList<>(result.values());
+    }
+
+    /**
+     * Get first valid password policy.
+     *
+     * @return parent password policy if isInheritPasswordPolicy is 'true' and 
parent is not null, local password policy
+     * otherwise
+     */
+    @Override
+    public PasswordPolicy getPasswordPolicy() {
+        return isInheritPasswordPolicy() && getParent() != null
+                ? getParent().getPasswordPolicy()
+                : passwordPolicy;
+    }
+
+    @Override
+    public void setPasswordPolicy(final PasswordPolicy passwordPolicy) {
+        checkType(passwordPolicy, JPAPasswordPolicy.class);
+        this.passwordPolicy = (JPAPasswordPolicy) passwordPolicy;
+    }
+
+    @Override
+    public boolean isInheritPasswordPolicy() {
+        return isBooleanAsInteger(inheritPasswordPolicy);
+    }
+
+    @Override
+    public void setInheritPasswordPolicy(final boolean inheritPasswordPolicy) {
+        this.inheritPasswordPolicy = 
getBooleanAsInteger(inheritPasswordPolicy);
+    }
+
+    /**
+     * Get first valid account policy.
+     *
+     * @return parent account policy if isInheritAccountPolicy is 'true' and 
parent is not null, local account policy
+     * otherwise.
+     */
+    @Override
+    public AccountPolicy getAccountPolicy() {
+        return isInheritAccountPolicy() && getParent() != null
+                ? getParent().getAccountPolicy()
+                : accountPolicy;
+    }
+
+    @Override
+    public void setAccountPolicy(final AccountPolicy accountPolicy) {
+        checkType(accountPolicy, JPAAccountPolicy.class);
+        this.accountPolicy = (JPAAccountPolicy) accountPolicy;
+    }
+
+    @Override
+    public boolean isInheritAccountPolicy() {
+        return isBooleanAsInteger(inheritAccountPolicy);
+    }
+
+    @Override
+    public void setInheritAccountPolicy(boolean inheritAccountPolicy) {
+        this.inheritAccountPolicy = getBooleanAsInteger(inheritAccountPolicy);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttr.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttr.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttr.java
index f2d1ff0..698f68c 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttr.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttr.java
@@ -76,7 +76,7 @@ public class JPAMDerAttr extends AbstractDerAttr implements 
MDerAttr {
 
     @Override
     public void setSchema(final DerSchema schema) {
-        LOG.warn("This is role attribute, set template to select schema");
+        LOG.warn("This is membership attribute, set template to select 
schema");
     }
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttrTemplate.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttrTemplate.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttrTemplate.java
index 0586c38..2139cd5 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttrTemplate.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttrTemplate.java
@@ -24,9 +24,9 @@ import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 import 
org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate;
 import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
 import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARole;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
 
 @Entity
 @Table(name = JPAMDerAttrTemplate.TABLE)
@@ -37,7 +37,7 @@ public class JPAMDerAttrTemplate extends 
AbstractDerAttrTemplate<MDerSchema> imp
     public static final String TABLE = "MDerAttrTemplate";
 
     @ManyToOne
-    private JPARole owner;
+    private JPAGroup owner;
 
     @ManyToOne
     @JoinColumn(name = "schema_name")
@@ -55,13 +55,13 @@ public class JPAMDerAttrTemplate extends 
AbstractDerAttrTemplate<MDerSchema> imp
     }
 
     @Override
-    public Role getOwner() {
+    public Group getOwner() {
         return owner;
     }
 
     @Override
-    public void setOwner(final Role owner) {
-        checkType(owner, JPARole.class);
-        this.owner = (JPARole) owner;
+    public void setOwner(final Group owner) {
+        checkType(owner, JPAGroup.class);
+        this.owner = (JPAGroup) owner;
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttr.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttr.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttr.java
index 330f7ec..a6c19ff 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttr.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttr.java
@@ -107,7 +107,7 @@ public class JPAMPlainAttr extends AbstractPlainAttr 
implements MPlainAttr {
 
     @Override
     public void setSchema(final PlainSchema schema) {
-        LOG.warn("This is role attribute, set template to select schema");
+        LOG.warn("This is membership attribute, set template to select 
schema");
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrTemplate.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrTemplate.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrTemplate.java
index 7379564..7b43ec7 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrTemplate.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrTemplate.java
@@ -25,9 +25,9 @@ import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 import 
org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate;
 import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
 import 
org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARole;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
 
 @Entity
 @Table(name = JPAMPlainAttrTemplate.TABLE)
@@ -41,7 +41,7 @@ public class JPAMPlainAttrTemplate extends 
AbstractPlainAttrTemplate<MPlainSchem
     private Long id;
 
     @ManyToOne
-    private JPARole owner;
+    private JPAGroup owner;
 
     @ManyToOne
     @JoinColumn(name = "schema_name")
@@ -64,14 +64,14 @@ public class JPAMPlainAttrTemplate extends 
AbstractPlainAttrTemplate<MPlainSchem
     }
 
     @Override
-    public JPARole getOwner() {
+    public JPAGroup getOwner() {
         return owner;
     }
 
     @Override
-    public void setOwner(final Role owner) {
-        checkType(owner, JPARole.class);
-        this.owner = (JPARole) owner;
+    public void setOwner(final Group owner) {
+        checkType(owner, JPAGroup.class);
+        this.owner = (JPAGroup) owner;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttr.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttr.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttr.java
index 6a1bc39..ba7fe06 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttr.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttr.java
@@ -76,6 +76,6 @@ public class JPAMVirAttr extends AbstractVirAttr implements 
MVirAttr {
 
     @Override
     public void setSchema(final VirSchema schema) {
-        LOG.warn("This is role attribute, set template to select schema");
+        LOG.warn("This is membership attribute, set template to select 
schema");
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttrTemplate.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttrTemplate.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttrTemplate.java
index b2a90f8..da84c4d 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttrTemplate.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttrTemplate.java
@@ -24,9 +24,9 @@ import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 import 
org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
 import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
 import org.apache.syncope.core.persistence.jpa.entity.AbstractVirAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARole;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
 
 @Entity
 @Table(name = JPAMVirAttrTemplate.TABLE)
@@ -37,7 +37,7 @@ public class JPAMVirAttrTemplate extends 
AbstractVirAttrTemplate<MVirSchema> imp
     public static final String TABLE = "MVirAttrTemplate";
 
     @ManyToOne
-    private JPARole owner;
+    private JPAGroup owner;
 
     @ManyToOne
     @JoinColumn(name = "schema_name")
@@ -55,13 +55,13 @@ public class JPAMVirAttrTemplate extends 
AbstractVirAttrTemplate<MVirSchema> imp
     }
 
     @Override
-    public Role getOwner() {
+    public Group getOwner() {
         return owner;
     }
 
     @Override
-    public void setOwner(final Role role) {
-        checkType(role, JPARole.class);
-        this.owner = (JPARole) role;
+    public void setOwner(final Group group) {
+        checkType(group, JPAGroup.class);
+        this.owner = (JPAGroup) group;
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
index 939fbc7..2579eba 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMembership.java
@@ -34,15 +34,15 @@ import 
org.apache.syncope.core.persistence.api.entity.membership.MPlainAttr;
 import org.apache.syncope.core.persistence.api.entity.membership.MVirAttr;
 import 
org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
 import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
 import org.apache.syncope.core.persistence.api.entity.user.User;
 import org.apache.syncope.core.persistence.jpa.entity.AbstractAttributable;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARole;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
 import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
 
 @Entity
 @Table(name = JPAMembership.TABLE, uniqueConstraints =
-        @UniqueConstraint(columnNames = { "user_id", "role_id" }))
+        @UniqueConstraint(columnNames = { "user_id", "group_id" }))
 public class JPAMembership extends AbstractAttributable<MPlainAttr, MDerAttr, 
MVirAttr> implements Membership {
 
     private static final long serialVersionUID = 5030106264797289469L;
@@ -56,7 +56,7 @@ public class JPAMembership extends 
AbstractAttributable<MPlainAttr, MDerAttr, MV
     private JPAUser user;
 
     @ManyToOne
-    private JPARole role;
+    private JPAGroup group;
 
     @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
     @Valid
@@ -84,14 +84,14 @@ public class JPAMembership extends 
AbstractAttributable<MPlainAttr, MDerAttr, MV
     }
 
     @Override
-    public Role getRole() {
-        return role;
+    public Group getGroup() {
+        return group;
     }
 
     @Override
-    public void setRole(final Role role) {
-        checkType(role, JPARole.class);
-        this.role = (JPARole) role;
+    public void setGroup(final Group group) {
+        checkType(group, JPAGroup.class);
+        this.group = (JPAGroup) group;
     }
 
     @Override
@@ -126,9 +126,9 @@ public class JPAMembership extends 
AbstractAttributable<MPlainAttr, MDerAttr, MV
     public boolean addDerAttr(final MDerAttr derAttr) {
         checkType(derAttr, JPAMDerAttr.class);
 
-        if (getRole() != null && derAttr.getSchema() != null) {
+        if (getGroup() != null && derAttr.getSchema() != null) {
             MDerAttrTemplate found = null;
-            for (MDerAttrTemplate template : 
getRole().findInheritedTemplates(MDerAttrTemplate.class)) {
+            for (MDerAttrTemplate template : 
getGroup().findInheritedTemplates(MDerAttrTemplate.class)) {
                 if (derAttr.getSchema().equals(template.getSchema())) {
                     found = template;
                 }
@@ -139,7 +139,7 @@ public class JPAMembership extends 
AbstractAttributable<MPlainAttr, MDerAttr, MV
             }
         }
 
-        LOG.warn("Attribute not added because either role was not yet set, "
+        LOG.warn("Attribute not added because either group was not yet set, "
                 + "schema was not specified or no template for that schema is 
available");
         return false;
     }
@@ -159,9 +159,9 @@ public class JPAMembership extends 
AbstractAttributable<MPlainAttr, MDerAttr, MV
     public boolean addVirAttr(final MVirAttr virAttr) {
         checkType(virAttr, JPAMVirAttr.class);
 
-        if (getRole() != null && virAttr.getSchema() != null) {
+        if (getGroup() != null && virAttr.getSchema() != null) {
             MVirAttrTemplate found = null;
-            for (MVirAttrTemplate template : 
getRole().findInheritedTemplates(MVirAttrTemplate.class)) {
+            for (MVirAttrTemplate template : 
getGroup().findInheritedTemplates(MVirAttrTemplate.class)) {
                 if (virAttr.getSchema().equals(template.getSchema())) {
                     found = template;
                 }
@@ -190,6 +190,6 @@ public class JPAMembership extends 
AbstractAttributable<MPlainAttr, MDerAttr, MV
 
     @Override
     public String toString() {
-        return "Membership[" + "id=" + id + ", " + user + ", " + role + ']';
+        return "Membership[" + "id=" + id + ", " + user + ", " + group + ']';
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerAttr.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerAttr.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerAttr.java
deleted file mode 100644
index 8cffa45..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerAttr.java
+++ /dev/null
@@ -1,82 +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.role;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.Attributable;
-import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RDerSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttr;
-
-@Entity
-@Table(name = JPARDerAttr.TABLE)
-public class JPARDerAttr extends AbstractDerAttr implements RDerAttr {
-
-    private static final long serialVersionUID = 8007080005675899946L;
-
-    public static final String TABLE = "RDerAttr";
-
-    @ManyToOne
-    private JPARole owner;
-
-    @Column(nullable = false)
-    @OneToOne(cascade = CascadeType.MERGE)
-    private JPARDerAttrTemplate template;
-
-    @Override
-    public Role getOwner() {
-        return owner;
-    }
-
-    @Override
-    public void setOwner(final Attributable<?, ?, ?> owner) {
-        checkType(owner, JPARole.class);
-        this.owner = (JPARole) owner;
-    }
-
-    @Override
-    public RDerAttrTemplate getTemplate() {
-        return template;
-    }
-
-    @Override
-    public void setTemplate(final RDerAttrTemplate template) {
-        checkType(template, JPARDerAttrTemplate.class);
-        this.template = (JPARDerAttrTemplate) template;
-    }
-
-    @Override
-    public RDerSchema getSchema() {
-        return template == null ? null : template.getSchema();
-    }
-
-    @Override
-    public void setSchema(final DerSchema schema) {
-        LOG.warn("This is role attribute, set template to select schema");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerAttrTemplate.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerAttrTemplate.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerAttrTemplate.java
deleted file mode 100644
index 022358e..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerAttrTemplate.java
+++ /dev/null
@@ -1,66 +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.role;
-
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.role.RDerAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RDerSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttrTemplate;
-
-@Entity
-@Table(name = JPARDerAttrTemplate.TABLE)
-public class JPARDerAttrTemplate extends AbstractDerAttrTemplate<RDerSchema> 
implements RDerAttrTemplate {
-
-    private static final long serialVersionUID = 624868884107016649L;
-
-    public static final String TABLE = "RDerAttrTemplate";
-
-    @ManyToOne
-    private JPARole owner;
-
-    @ManyToOne
-    @JoinColumn(name = "schema_name")
-    private JPARDerSchema schema;
-
-    @Override
-    public RDerSchema getSchema() {
-        return schema;
-    }
-
-    @Override
-    public void setSchema(final RDerSchema schema) {
-        checkType(schema, JPARDerSchema.class);
-        this.schema = (JPARDerSchema) schema;
-    }
-
-    @Override
-    public Role getOwner() {
-        return owner;
-    }
-
-    @Override
-    public void setOwner(final Role owner) {
-        checkType(owner, JPARole.class);
-        this.owner = (JPARole) owner;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerSchema.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerSchema.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerSchema.java
deleted file mode 100644
index 2ef23fc..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARDerSchema.java
+++ /dev/null
@@ -1,34 +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.role;
-
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.role.RDerSchema;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractDerSchema;
-
-@Entity
-@Table(name = JPARDerSchema.TABLE)
-public class JPARDerSchema extends AbstractDerSchema implements RDerSchema {
-
-    private static final long serialVersionUID = -6868889736207576372L;
-
-    public static final String TABLE = "RDerSchema";
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARMapping.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARMapping.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARMapping.java
deleted file mode 100644
index 9a5f82d..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARMapping.java
+++ /dev/null
@@ -1,103 +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.role;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.role.RMapping;
-import org.apache.syncope.core.persistence.api.entity.role.RMappingItem;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractMapping;
-import org.apache.syncope.core.persistence.jpa.entity.JPAExternalResource;
-
-@Entity
-@Table(name = JPARMapping.TABLE)
-public class JPARMapping extends AbstractMapping<RMappingItem> implements 
RMapping {
-
-    public static final String TABLE = "RMapping";
-
-    private static final long serialVersionUID = 4578756002867863392L;
-
-    @Id
-    private Long id;
-
-    /**
-     * Resource owning this mapping.
-     */
-    @OneToOne
-    private JPAExternalResource resource;
-
-    /**
-     * Attribute mappings.
-     */
-    @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = 
FetchType.EAGER, mappedBy = "mapping")
-    private List<JPARMappingItem> items;
-
-    public JPARMapping() {
-        super();
-
-        items = new ArrayList<>();
-    }
-
-    @Override
-    public Long getKey() {
-        return id;
-    }
-
-    @Override
-    public ExternalResource getResource() {
-        return resource;
-    }
-
-    @Override
-    public void setResource(final ExternalResource resource) {
-        checkType(resource, JPAExternalResource.class);
-        this.resource = (JPAExternalResource) resource;
-    }
-
-    @Override
-    public void setAccountIdItem(final RMappingItem item) {
-        checkType(item, JPARMappingItem.class);
-        this.addAccountIdItem((JPARMappingItem) item);
-    }
-
-    @Override
-    public List<? extends RMappingItem> getItems() {
-        return items;
-    }
-
-    @Override
-    public boolean addItem(final RMappingItem item) {
-        checkType(item, JPARMappingItem.class);
-        return items.contains((JPARMappingItem) item) || 
items.add((JPARMappingItem) item);
-    }
-
-    @Override
-    public boolean removeItem(final RMappingItem item) {
-        checkType(item, JPARMappingItem.class);
-        return items.remove((JPARMappingItem) item);
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARMappingItem.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARMappingItem.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARMappingItem.java
deleted file mode 100644
index 931d543..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARMappingItem.java
+++ /dev/null
@@ -1,58 +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.role;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.Mapping;
-import org.apache.syncope.core.persistence.api.entity.role.RMappingItem;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractMappingItem;
-
-@Entity
-@Table(name = JPARMappingItem.TABLE)
-public class JPARMappingItem extends AbstractMappingItem implements 
RMappingItem {
-
-    public static final String TABLE = "RMappingItem";
-
-    private static final long serialVersionUID = -2670787666933476166L;
-
-    @Id
-    private Long id;
-
-    @ManyToOne
-    private JPARMapping mapping;
-
-    @Override
-    public Long getKey() {
-        return id;
-    }
-
-    @Override
-    public Mapping<RMappingItem> getMapping() {
-        return mapping;
-    }
-
-    @Override
-    public void setMapping(final Mapping<?> mapping) {
-        checkType(mapping, JPARMapping.class);
-        this.mapping = (JPARMapping) mapping;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttr.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttr.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttr.java
deleted file mode 100644
index a640d8d..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttr.java
+++ /dev/null
@@ -1,140 +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.role;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.validation.Valid;
-import org.apache.syncope.core.persistence.api.entity.Attributable;
-import org.apache.syncope.core.persistence.api.entity.PlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrTemplate;
-import 
org.apache.syncope.core.persistence.api.entity.role.RPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttr;
-
-@Entity
-@Table(name = JPARPlainAttr.TABLE)
-public class JPARPlainAttr extends AbstractPlainAttr implements RPlainAttr {
-
-    private static final long serialVersionUID = 2848159565890995780L;
-
-    public static final String TABLE = "RPlainAttr";
-
-    @Id
-    private Long id;
-
-    @ManyToOne(fetch = FetchType.EAGER)
-    private JPARole owner;
-
-    @Column(nullable = false)
-    @OneToOne(cascade = CascadeType.MERGE)
-    private JPARPlainAttrTemplate template;
-
-    @OneToMany(cascade = CascadeType.MERGE, orphanRemoval = true, mappedBy = 
"attribute")
-    @Valid
-    private List<JPARPlainAttrValue> values;
-
-    @OneToOne(cascade = CascadeType.ALL, mappedBy = "attribute")
-    @Valid
-    private JPARPlainAttrUniqueValue uniqueValue;
-
-    public JPARPlainAttr() {
-        super();
-        values = new ArrayList<>();
-    }
-
-    @Override
-    public Long getKey() {
-        return id;
-    }
-
-    @Override
-    public Role getOwner() {
-        return owner;
-    }
-
-    @Override
-    public void setOwner(final Attributable<?, ?, ?> owner) {
-        checkType(owner, JPARole.class);
-        this.owner = (JPARole) owner;
-    }
-
-    @Override
-    public RPlainAttrTemplate getTemplate() {
-        return template;
-    }
-
-    @Override
-    public void setTemplate(final RPlainAttrTemplate template) {
-        checkType(template, JPARPlainAttrTemplate.class);
-        this.template = (JPARPlainAttrTemplate) template;
-    }
-
-    @Override
-    public RPlainSchema getSchema() {
-        return template == null ? null : template.getSchema();
-    }
-
-    @Override
-    public void setSchema(final PlainSchema schema) {
-        LOG.warn("This is role attribute, set template to select schema");
-    }
-
-    @Override
-    protected boolean addValue(final PlainAttrValue attrValue) {
-        checkType(attrValue, JPARPlainAttrValue.class);
-        return values.add((JPARPlainAttrValue) attrValue);
-    }
-
-    @Override
-    public boolean removeValue(final PlainAttrValue attrValue) {
-        checkType(attrValue, JPARPlainAttrValue.class);
-        return values.remove((JPARPlainAttrValue) attrValue);
-    }
-
-    @Override
-    public List<? extends RPlainAttrValue> getValues() {
-        return values;
-    }
-
-    @Override
-    public RPlainAttrUniqueValue getUniqueValue() {
-        return uniqueValue;
-    }
-
-    @Override
-    public void setUniqueValue(final PlainAttrUniqueValue uniqueValue) {
-        checkType(owner, JPARPlainAttrUniqueValue.class);
-        this.uniqueValue = (JPARPlainAttrUniqueValue) uniqueValue;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrTemplate.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrTemplate.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrTemplate.java
deleted file mode 100644
index b3e2a3c..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrTemplate.java
+++ /dev/null
@@ -1,75 +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.role;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import 
org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrTemplate;
-
-@Entity
-@Table(name = JPARPlainAttrTemplate.TABLE)
-public class JPARPlainAttrTemplate extends 
AbstractPlainAttrTemplate<RPlainSchema> implements RPlainAttrTemplate {
-
-    private static final long serialVersionUID = 6943917051517266268L;
-
-    public static final String TABLE = "RPlainAttrTemplate";
-
-    @Id
-    private Long id;
-
-    @ManyToOne
-    private JPARole owner;
-
-    @Override
-    public Long getKey() {
-        return id;
-    }
-
-    @ManyToOne
-    @JoinColumn(name = "schema_name")
-    private JPARPlainSchema schema;
-
-    @Override
-    public RPlainSchema getSchema() {
-        return schema;
-    }
-
-    @Override
-    public void setSchema(final RPlainSchema schema) {
-        checkType(schema, JPARPlainSchema.class);
-        this.schema = (JPARPlainSchema) schema;
-    }
-
-    @Override
-    public Role getOwner() {
-        return owner;
-    }
-
-    @Override
-    public void setOwner(final Role owner) {
-        checkType(owner, JPARole.class);
-        this.owner = (JPARole) owner;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrUniqueValue.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrUniqueValue.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrUniqueValue.java
deleted file mode 100644
index 59ffb2a..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrUniqueValue.java
+++ /dev/null
@@ -1,78 +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.role;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-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.role.RPlainAttr;
-import 
org.apache.syncope.core.persistence.api.entity.role.RPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue;
-
-@Entity
-@Table(name = JPARPlainAttrUniqueValue.TABLE)
-public class JPARPlainAttrUniqueValue extends AbstractPlainAttrValue 
implements RPlainAttrUniqueValue {
-
-    private static final long serialVersionUID = 4681561795607192855L;
-
-    public static final String TABLE = "RPlainAttrUniqueValue";
-
-    @Id
-    private Long id;
-
-    @OneToOne(optional = false)
-    private JPARPlainAttr attribute;
-
-    @ManyToOne(optional = false)
-    @JoinColumn(name = "schema_name")
-    private JPARPlainSchema schema;
-
-    @Override
-    public Long getKey() {
-        return id;
-    }
-
-    @Override
-    public RPlainAttr getAttr() {
-        return attribute;
-    }
-
-    @Override
-    public void setAttr(final PlainAttr attr) {
-        checkType(attr, JPARPlainAttr.class);
-        this.attribute = (JPARPlainAttr) attr;
-    }
-
-    @Override
-    public RPlainSchema getSchema() {
-        return schema;
-    }
-
-    @Override
-    public void setSchema(final PlainSchema schema) {
-        checkType(schema, JPARPlainSchema.class);
-        this.schema = (JPARPlainSchema) schema;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrValue.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrValue.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrValue.java
deleted file mode 100644
index 6db5e98..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainAttrValue.java
+++ /dev/null
@@ -1,64 +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.role;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import org.apache.syncope.core.persistence.api.entity.PlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrValue;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue;
-
-@Entity
-@Table(name = JPARPlainAttrValue.TABLE)
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
-public class JPARPlainAttrValue extends AbstractPlainAttrValue implements 
RPlainAttrValue {
-
-    private static final long serialVersionUID = -766808291128424707L;
-
-    public static final String TABLE = "RPlainAttrValue";
-
-    @Id
-    private Long id;
-
-    @ManyToOne
-    @NotNull
-    private JPARPlainAttr attribute;
-
-    @Override
-    public Long getKey() {
-        return id;
-    }
-
-    @Override
-    public RPlainAttr getAttr() {
-        return attribute;
-    }
-
-    @Override
-    public void setAttr(final PlainAttr attr) {
-        checkType(attr, JPARPlainAttr.class);
-        this.attribute = (JPARPlainAttr) attr;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainSchema.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainSchema.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainSchema.java
deleted file mode 100644
index 98d3285..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARPlainSchema.java
+++ /dev/null
@@ -1,36 +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.role;
-
-import javax.persistence.Cacheable;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainSchema;
-
-@Entity
-@Table(name = JPARPlainSchema.TABLE)
-@Cacheable
-public class JPARPlainSchema extends AbstractPlainSchema implements 
RPlainSchema {
-
-    private static final long serialVersionUID = -7417234690221851342L;
-
-    public static final String TABLE = "RPlainSchema";
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirAttr.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirAttr.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirAttr.java
deleted file mode 100644
index e82282d..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirAttr.java
+++ /dev/null
@@ -1,82 +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.role;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.Attributable;
-import org.apache.syncope.core.persistence.api.entity.VirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttr;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RVirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractVirAttr;
-
-@Entity
-@Table(name = JPARVirAttr.TABLE)
-public class JPARVirAttr extends AbstractVirAttr implements RVirAttr {
-
-    private static final long serialVersionUID = -1747430556914428649L;
-
-    public static final String TABLE = "RVirAttr";
-
-    @ManyToOne
-    private JPARole owner;
-
-    @Column(nullable = false)
-    @OneToOne(cascade = CascadeType.MERGE)
-    private JPARVirAttrTemplate template;
-
-    @Override
-    public Role getOwner() {
-        return owner;
-    }
-
-    @Override
-    public void setOwner(final Attributable<?, ?, ?> owner) {
-        checkType(owner, JPARole.class);
-        this.owner = (JPARole) owner;
-    }
-
-    @Override
-    public RVirAttrTemplate getTemplate() {
-        return template;
-    }
-
-    @Override
-    public void setTemplate(final RVirAttrTemplate template) {
-        checkType(template, JPARVirAttrTemplate.class);
-        this.template = (JPARVirAttrTemplate) template;
-    }
-
-    @Override
-    public RVirSchema getSchema() {
-        return template == null ? null : template.getSchema();
-    }
-
-    @Override
-    public void setSchema(final VirSchema schema) {
-        LOG.warn("This is role attribute, set template to select schema");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirAttrTemplate.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirAttrTemplate.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirAttrTemplate.java
deleted file mode 100644
index 067eb26..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirAttrTemplate.java
+++ /dev/null
@@ -1,66 +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.role;
-
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.role.RVirAttrTemplate;
-import org.apache.syncope.core.persistence.api.entity.role.RVirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.Role;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractVirAttrTemplate;
-
-@Entity
-@Table(name = JPARVirAttrTemplate.TABLE)
-public class JPARVirAttrTemplate extends AbstractVirAttrTemplate<RVirSchema> 
implements RVirAttrTemplate {
-
-    private static final long serialVersionUID = 4896495904794493479L;
-
-    public static final String TABLE = "RVirAttrTemplate";
-
-    @ManyToOne
-    private JPARole owner;
-
-    @ManyToOne
-    @JoinColumn(name = "schema_name")
-    private JPARVirSchema schema;
-
-    @Override
-    public RVirSchema getSchema() {
-        return schema;
-    }
-
-    @Override
-    public void setSchema(final RVirSchema schema) {
-        checkType(schema, JPARVirSchema.class);
-        this.schema = (JPARVirSchema) schema;
-    }
-
-    @Override
-    public Role getOwner() {
-        return owner;
-    }
-
-    @Override
-    public void setOwner(final Role role) {
-        checkType(role, JPARole.class);
-        this.owner = (JPARole) role;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirSchema.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirSchema.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirSchema.java
deleted file mode 100644
index cadf3dc..0000000
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARVirSchema.java
+++ /dev/null
@@ -1,36 +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.role;
-
-import javax.persistence.Cacheable;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.role.RVirSchema;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractVirSchema;
-
-@Entity
-@Table(name = JPARVirSchema.TABLE)
-@Cacheable
-public class JPARVirSchema extends AbstractVirSchema implements RVirSchema {
-
-    private static final long serialVersionUID = -2595041749349652939L;
-
-    public static final String TABLE = "RVirSchema";
-
-}

Reply via email to