http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/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 f7a1e55..2da7ef5 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
@@ -32,13 +32,13 @@ import 
org.apache.syncope.core.persistence.api.entity.AttributableUtil;
 import org.apache.syncope.core.persistence.api.entity.VirAttr;
 import org.apache.syncope.core.persistence.api.entity.VirSchema;
 import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema;
-import org.apache.syncope.core.persistence.api.entity.role.RVirSchema;
+import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
 import org.apache.syncope.core.persistence.api.entity.user.UMappingItem;
 import org.apache.syncope.core.persistence.api.entity.user.UVirAttr;
 import org.apache.syncope.core.persistence.api.entity.user.UVirSchema;
 import org.apache.syncope.core.persistence.jpa.entity.AbstractVirSchema;
 import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirSchema;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirSchema;
 import org.apache.syncope.core.persistence.jpa.entity.user.JPAUVirSchema;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Repository;
@@ -56,8 +56,8 @@ public class JPAVirSchemaDAO extends AbstractDAO<VirSchema, 
String> implements V
     private ExternalResourceDAO resourceDAO;
 
     private <T extends VirSchema> Class<? extends AbstractVirSchema> 
getJPAEntityReference(final Class<T> reference) {
-        return RVirSchema.class.isAssignableFrom(reference)
-                ? JPARVirSchema.class
+        return GVirSchema.class.isAssignableFrom(reference)
+                ? JPAGVirSchema.class
                 : MVirSchema.class.isAssignableFrom(reference)
                         ? JPAMVirSchema.class
                         : UVirSchema.class.isAssignableFrom(reference)

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/SearchSupport.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/SearchSupport.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/SearchSupport.java
index 6922b85..77d133b 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/SearchSupport.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/SearchSupport.java
@@ -94,8 +94,8 @@ class SearchSupport {
                 result = "user_search";
                 break;
 
-            case ROLE:
-                result = "role_search";
+            case GROUP:
+                result = "group_search";
                 break;
         }
 
@@ -118,8 +118,8 @@ class SearchSupport {
         return new SearchView("svr", field().name + "_resource");
     }
 
-    public SearchView roleResource() {
-        return new SearchView("svrr", field().name + "_role_resource");
+    public SearchView groupResource() {
+        return new SearchView("svrr", field().name + "_group_resource");
     }
 
     public SearchView uniqueAttr() {

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMapping.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMapping.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMapping.java
index 3a85859..814909d 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMapping.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMapping.java
@@ -58,7 +58,7 @@ public abstract class AbstractMapping<T extends MappingItem> 
extends AbstractEnt
 
     protected boolean addAccountIdItem(final T accountIdItem) {
         if (IntMappingType.UserVirtualSchema == 
accountIdItem.getIntMappingType()
-                || IntMappingType.RoleVirtualSchema == 
accountIdItem.getIntMappingType()
+                || IntMappingType.GroupVirtualSchema == 
accountIdItem.getIntMappingType()
                 || IntMappingType.MembershipVirtualSchema == 
accountIdItem.getIntMappingType()
                 || IntMappingType.Password == 
accountIdItem.getIntMappingType()) {
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMappingItem.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMappingItem.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMappingItem.java
index c183908..98aab13 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMappingItem.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractMappingItem.java
@@ -115,7 +115,7 @@ public abstract class AbstractMappingItem extends 
AbstractEntity<Long> implement
 
         switch (getIntMappingType()) {
             case UserId:
-            case RoleId:
+            case GroupId:
             case MembershipId:
                 name = "id";
                 break;
@@ -128,12 +128,12 @@ public abstract class AbstractMappingItem extends 
AbstractEntity<Long> implement
                 name = "password";
                 break;
 
-            case RoleName:
-                name = "roleName";
+            case GroupName:
+                name = "groupName";
                 break;
 
-            case RoleOwnerSchema:
-                name = "roleOwnerSchema";
+            case GroupOwnerSchema:
+                name = "groupOwnerSchema";
                 break;
 
             default:

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java
index 3b744c6..0ccf030 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java
@@ -25,7 +25,7 @@ import 
org.apache.syncope.common.lib.to.AbstractAttributableTO;
 import org.apache.syncope.common.lib.to.AbstractSubjectTO;
 import org.apache.syncope.common.lib.to.ConfTO;
 import org.apache.syncope.common.lib.to.MembershipTO;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.GroupTO;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.types.AttributableType;
 import org.apache.syncope.common.lib.types.IntMappingType;
@@ -59,19 +59,19 @@ import 
org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttr;
 import 
org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
 import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirSchema;
 import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMembership;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerAttr;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerSchema;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARMappingItem;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttr;
-import 
org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrTemplate;
-import 
org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrValue;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainSchema;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirAttr;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirSchema;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARole;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttr;
+import 
org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr;
+import 
org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrTemplate;
+import 
org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirAttr;
+import 
org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
 import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerAttr;
 import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerSchema;
 import org.apache.syncope.core.persistence.jpa.entity.user.JPAUMappingItem;
@@ -110,8 +110,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
         Class result;
 
         switch (type) {
-            case ROLE:
-                result = JPARole.class;
+            case GROUP:
+                result = JPAGroup.class;
                 break;
 
             case MEMBERSHIP:
@@ -135,8 +135,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
         Class result;
 
         switch (type) {
-            case ROLE:
-                result = JPARPlainSchema.class;
+            case GROUP:
+                result = JPAGPlainSchema.class;
                 break;
 
             case MEMBERSHIP:
@@ -165,8 +165,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
                 result = (T) new JPAUPlainSchema();
                 break;
 
-            case ROLE:
-                result = (T) new JPARPlainSchema();
+            case GROUP:
+                result = (T) new JPAGPlainSchema();
                 break;
 
             case MEMBERSHIP:
@@ -186,8 +186,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
         Class result = null;
 
         switch (type) {
-            case ROLE:
-                result = JPARPlainAttr.class;
+            case GROUP:
+                result = JPAGPlainAttr.class;
                 break;
 
             case MEMBERSHIP:
@@ -216,8 +216,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
                 result = (T) new JPAUPlainAttr();
                 break;
 
-            case ROLE:
-                result = (T) new JPARPlainAttr();
+            case GROUP:
+                result = (T) new JPAGPlainAttr();
                 break;
 
             case MEMBERSHIP:
@@ -238,8 +238,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
         Class result;
 
         switch (type) {
-            case ROLE:
-                result = JPARPlainAttrValue.class;
+            case GROUP:
+                result = JPAGPlainAttrValue.class;
                 break;
 
             case MEMBERSHIP:
@@ -268,8 +268,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
                 result = (T) new JPAUPlainAttrValue();
                 break;
 
-            case ROLE:
-                result = (T) new JPARPlainAttrValue();
+            case GROUP:
+                result = (T) new JPAGPlainAttrValue();
                 break;
 
             case MEMBERSHIP:
@@ -291,8 +291,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
         Class result;
 
         switch (type) {
-            case ROLE:
-                result = JPARPlainAttrUniqueValue.class;
+            case GROUP:
+                result = JPAGPlainAttrUniqueValue.class;
                 break;
 
             case MEMBERSHIP:
@@ -321,8 +321,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
                 result = (T) new JPAUPlainAttrUniqueValue();
                 break;
 
-            case ROLE:
-                result = (T) new JPARPlainAttrUniqueValue();
+            case GROUP:
+                result = (T) new JPAGPlainAttrUniqueValue();
                 break;
 
             case MEMBERSHIP:
@@ -344,8 +344,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
         Class result;
 
         switch (type) {
-            case ROLE:
-                result = JPARPlainAttrTemplate.class;
+            case GROUP:
+                result = JPAGPlainAttrTemplate.class;
                 break;
 
             case MEMBERSHIP:
@@ -370,8 +370,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
                 result = JPAUDerSchema.class;
                 break;
 
-            case ROLE:
-                result = JPARDerSchema.class;
+            case GROUP:
+                result = JPAGDerSchema.class;
                 break;
 
             case MEMBERSHIP:
@@ -395,8 +395,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
                 result = (T) new JPAUDerSchema();
                 break;
 
-            case ROLE:
-                result = (T) new JPARDerSchema();
+            case GROUP:
+                result = (T) new JPAGDerSchema();
                 break;
 
             case MEMBERSHIP:
@@ -419,8 +419,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
                 result = JPAUDerAttr.class;
                 break;
 
-            case ROLE:
-                result = JPARDerAttr.class;
+            case GROUP:
+                result = JPAGDerAttr.class;
                 break;
 
             case MEMBERSHIP:
@@ -443,8 +443,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
                 result = (T) new JPAUDerAttr();
                 break;
 
-            case ROLE:
-                result = (T) new JPARDerAttr();
+            case GROUP:
+                result = (T) new JPAGDerAttr();
                 break;
 
             case MEMBERSHIP:
@@ -466,8 +466,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
             case USER:
                 break;
 
-            case ROLE:
-                result = JPARDerAttrTemplate.class;
+            case GROUP:
+                result = JPAGDerAttrTemplate.class;
                 break;
 
             case MEMBERSHIP:
@@ -490,8 +490,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
                 result = JPAUVirSchema.class;
                 break;
 
-            case ROLE:
-                result = JPARVirSchema.class;
+            case GROUP:
+                result = JPAGVirSchema.class;
                 break;
 
             case MEMBERSHIP:
@@ -514,8 +514,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
                 result = (T) new JPAUVirSchema();
                 break;
 
-            case ROLE:
-                result = (T) new JPARVirSchema();
+            case GROUP:
+                result = (T) new JPAGVirSchema();
                 break;
 
             case MEMBERSHIP:
@@ -538,8 +538,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
                 result = JPAUVirAttr.class;
                 break;
 
-            case ROLE:
-                result = JPARVirAttr.class;
+            case GROUP:
+                result = JPAGVirAttr.class;
                 break;
 
             case MEMBERSHIP:
@@ -562,8 +562,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
                 result = (T) new JPAUVirAttr();
                 break;
 
-            case ROLE:
-                result = (T) new JPARVirAttr();
+            case GROUP:
+                result = (T) new JPAGVirAttr();
                 break;
 
             case MEMBERSHIP:
@@ -585,8 +585,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
             case USER:
                 break;
 
-            case ROLE:
-                result = JPARVirAttrTemplate.class;
+            case GROUP:
+                result = JPAGVirAttrTemplate.class;
                 break;
 
             case MEMBERSHIP:
@@ -606,9 +606,9 @@ public class JPAAttributableUtil implements 
AttributableUtil {
 
         if (resource != null) {
             switch (type) {
-                case ROLE:
-                    if (resource.getRmapping() != null) {
-                        result = (T) resource.getRmapping().getAccountIdItem();
+                case GROUP:
+                    if (resource.getGmapping() != null) {
+                        result = (T) resource.getGmapping().getAccountIdItem();
                     }
                     break;
 
@@ -638,9 +638,9 @@ public class JPAAttributableUtil implements 
AttributableUtil {
                     }
                     break;
 
-                case ROLE:
-                    if (resource.getRmapping() != null) {
-                        result = resource.getRmapping().getAccountLink();
+                case GROUP:
+                    if (resource.getGmapping() != null) {
+                        result = resource.getGmapping().getAccountLink();
                     }
                     break;
 
@@ -661,9 +661,9 @@ public class JPAAttributableUtil implements 
AttributableUtil {
 
         if (resource != null) {
             switch (type) {
-                case ROLE:
-                    if (resource.getRmapping() != null) {
-                        items = (List<T>) resource.getRmapping().getItems();
+                case GROUP:
+                    if (resource.getGmapping() != null) {
+                        items = (List<T>) resource.getGmapping().getItems();
                     }
                     break;
 
@@ -729,7 +729,7 @@ public class JPAAttributableUtil implements 
AttributableUtil {
 
         List<T> items = getMappingItems(resource, purpose);
 
-        MappingItem uidItem = type == AttributableType.USER ? new 
JPAUMappingItem() : new JPARMappingItem();
+        MappingItem uidItem = type == AttributableType.USER ? new 
JPAUMappingItem() : new JPAGMappingItem();
         BeanUtils.copyProperties(getAccountIdItem(resource), uidItem);
         uidItem.setExtAttrName(Uid.NAME);
         uidItem.setAccountid(false);
@@ -743,8 +743,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
         IntMappingType result = null;
 
         switch (type) {
-            case ROLE:
-                result = IntMappingType.RolePlainSchema;
+            case GROUP:
+                result = IntMappingType.GroupPlainSchema;
                 break;
 
             case MEMBERSHIP:
@@ -767,8 +767,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
         IntMappingType result = null;
 
         switch (type) {
-            case ROLE:
-                result = IntMappingType.RoleDerivedSchema;
+            case GROUP:
+                result = IntMappingType.GroupDerivedSchema;
                 break;
 
             case MEMBERSHIP:
@@ -791,8 +791,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
         IntMappingType result = null;
 
         switch (type) {
-            case ROLE:
-                result = IntMappingType.RoleVirtualSchema;
+            case GROUP:
+                result = IntMappingType.GroupVirtualSchema;
                 break;
 
             case MEMBERSHIP:
@@ -819,8 +819,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
                 result = JPAUMappingItem.class;
                 break;
 
-            case ROLE:
-                result = JPARMappingItem.class;
+            case GROUP:
+                result = JPAGMappingItem.class;
                 break;
 
             case MEMBERSHIP:
@@ -842,8 +842,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
             case USER:
                 result = (T) new UserTO();
                 break;
-            case ROLE:
-                result = (T) new RoleTO();
+            case GROUP:
+                result = (T) new GroupTO();
                 break;
             case MEMBERSHIP:
                 result = (T) new MembershipTO();
@@ -865,8 +865,8 @@ public class JPAAttributableUtil implements 
AttributableUtil {
             case USER:
                 result = (T) new UserTO();
                 break;
-            case ROLE:
-                result = (T) new RoleTO();
+            case GROUP:
+                result = (T) new GroupTO();
                 break;
             case MEMBERSHIP:
             case CONFIGURATION:

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
index 202a605..7cb012a 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
@@ -51,20 +51,20 @@ 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.MVirSchema;
 import org.apache.syncope.core.persistence.api.entity.membership.Membership;
-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.RMapping;
-import org.apache.syncope.core.persistence.api.entity.role.RMappingItem;
-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.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.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.GMapping;
+import org.apache.syncope.core.persistence.api.entity.group.GMappingItem;
+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.GPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
+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.task.NotificationTask;
 import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
 import org.apache.syncope.core.persistence.api.entity.task.PushTask;
@@ -100,20 +100,20 @@ import 
org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttr;
 import 
org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
 import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirSchema;
 import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMembership;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerAttr;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerSchema;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARMapping;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARMappingItem;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttr;
-import 
org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrTemplate;
-import 
org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrValue;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainSchema;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirAttr;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirAttrTemplate;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirSchema;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARole;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttr;
+import 
org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGMapping;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr;
+import 
org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrTemplate;
+import 
org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirAttr;
+import 
org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
 import org.apache.syncope.core.persistence.jpa.entity.task.JPANotificationTask;
 import org.apache.syncope.core.persistence.jpa.entity.task.JPAPropagationTask;
 import org.apache.syncope.core.persistence.jpa.entity.task.JPAPushTask;
@@ -143,8 +143,8 @@ public class JPAEntityFactory implements EntityFactory {
 
         if (reference.equals(User.class)) {
             result = (T) new JPAUser();
-        } else if (reference.equals(Role.class)) {
-            result = (T) new JPARole();
+        } else if (reference.equals(Group.class)) {
+            result = (T) new JPAGroup();
         } else if (reference.equals(Membership.class)) {
             result = (T) new JPAMembership();
         } else if (reference.equals(Conf.class)) {
@@ -177,32 +177,32 @@ public class JPAEntityFactory implements EntityFactory {
             result = (T) new JPAUMapping();
         } else if (reference.equals(UMappingItem.class)) {
             result = (T) new JPAUMappingItem();
-        } else if (reference.equals(RPlainSchema.class)) {
-            result = (T) new JPARPlainSchema();
-        } else if (reference.equals(RPlainAttr.class)) {
-            result = (T) new JPARPlainAttr();
-        } else if (reference.equals(RPlainAttrValue.class)) {
-            result = (T) new JPARPlainAttrValue();
-        } else if (reference.equals(RPlainAttrUniqueValue.class)) {
-            result = (T) new JPARPlainAttrUniqueValue();
-        } else if (reference.equals(RPlainAttrTemplate.class)) {
-            result = (T) new JPARPlainAttrTemplate();
-        } else if (reference.equals(RDerAttrTemplate.class)) {
-            result = (T) new JPARDerAttrTemplate();
-        } else if (reference.equals(RVirAttrTemplate.class)) {
-            result = (T) new JPARVirAttrTemplate();
-        } else if (reference.equals(RDerSchema.class)) {
-            result = (T) new JPARDerSchema();
-        } else if (reference.equals(RDerAttr.class)) {
-            result = (T) new JPARDerAttr();
-        } else if (reference.equals(RVirSchema.class)) {
-            result = (T) new JPARVirSchema();
-        } else if (reference.equals(RVirAttr.class)) {
-            result = (T) new JPARVirAttr();
-        } else if (reference.equals(RMapping.class)) {
-            result = (T) new JPARMapping();
-        } else if (reference.equals(RMappingItem.class)) {
-            result = (T) new JPARMappingItem();
+        } else if (reference.equals(GPlainSchema.class)) {
+            result = (T) new JPAGPlainSchema();
+        } else if (reference.equals(GPlainAttr.class)) {
+            result = (T) new JPAGPlainAttr();
+        } else if (reference.equals(GPlainAttrValue.class)) {
+            result = (T) new JPAGPlainAttrValue();
+        } else if (reference.equals(GPlainAttrUniqueValue.class)) {
+            result = (T) new JPAGPlainAttrUniqueValue();
+        } else if (reference.equals(GPlainAttrTemplate.class)) {
+            result = (T) new JPAGPlainAttrTemplate();
+        } else if (reference.equals(GDerAttrTemplate.class)) {
+            result = (T) new JPAGDerAttrTemplate();
+        } else if (reference.equals(GVirAttrTemplate.class)) {
+            result = (T) new JPAGVirAttrTemplate();
+        } else if (reference.equals(GDerSchema.class)) {
+            result = (T) new JPAGDerSchema();
+        } else if (reference.equals(GDerAttr.class)) {
+            result = (T) new JPAGDerAttr();
+        } else if (reference.equals(GVirSchema.class)) {
+            result = (T) new JPAGVirSchema();
+        } else if (reference.equals(GVirAttr.class)) {
+            result = (T) new JPAGVirAttr();
+        } else if (reference.equals(GMapping.class)) {
+            result = (T) new JPAGMapping();
+        } else if (reference.equals(GMappingItem.class)) {
+            result = (T) new JPAGMappingItem();
         } else if (reference.equals(MPlainSchema.class)) {
             result = (T) new JPAMPlainSchema();
         } else if (reference.equals(MPlainAttr.class)) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
index 49be3dc..e1c44aa 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAExternalResource.java
@@ -51,10 +51,10 @@ import 
org.apache.syncope.core.persistence.api.entity.ConnInstance;
 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.SyncPolicy;
-import org.apache.syncope.core.persistence.api.entity.role.RMapping;
+import org.apache.syncope.core.persistence.api.entity.group.GMapping;
 import org.apache.syncope.core.persistence.api.entity.user.UMapping;
 import 
org.apache.syncope.core.persistence.jpa.validation.entity.ExternalResourceCheck;
-import org.apache.syncope.core.persistence.jpa.entity.role.JPARMapping;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGMapping;
 import org.apache.syncope.core.persistence.jpa.entity.user.JPAUMapping;
 import org.apache.syncope.core.misc.serialization.POJOHelper;
 import org.identityconnectors.framework.common.objects.SyncToken;
@@ -100,10 +100,10 @@ public class JPAExternalResource extends 
AbstractAnnotatedEntity<String> impleme
     private JPAUMapping umapping;
 
     /**
-     * Mapping for role objects.
+     * Mapping for group objects.
      */
     @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = 
FetchType.EAGER, mappedBy = "resource")
-    private JPARMapping rmapping;
+    private JPAGMapping rmapping;
 
     /**
      * Is this resource primary, for propagations?
@@ -171,7 +171,7 @@ public class JPAExternalResource extends 
AbstractAnnotatedEntity<String> impleme
     private String userializedSyncToken;
 
     /**
-     * SyncToken for calling ConnId's sync() on roles.
+     * SyncToken for calling ConnId's sync() on groups.
      */
     @Lob
     private String rserializedSyncToken;
@@ -237,14 +237,14 @@ public class JPAExternalResource extends 
AbstractAnnotatedEntity<String> impleme
     }
 
     @Override
-    public RMapping getRmapping() {
+    public GMapping getGmapping() {
         return rmapping;
     }
 
     @Override
-    public void setRmapping(final RMapping rmapping) {
-        checkType(rmapping, JPARMapping.class);
-        this.rmapping = (JPARMapping) rmapping;
+    public void setGmapping(final GMapping gmapping) {
+        checkType(gmapping, JPAGMapping.class);
+        this.rmapping = (JPAGMapping) gmapping;
     }
 
     @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/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 de591e2..b97ca54 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
@@ -61,7 +61,7 @@ public class JPANotification extends AbstractEntity<Long> 
implements Notificatio
 
     private String userAbout;
 
-    private String roleAbout;
+    private String groupAbout;
 
     private String recipients;
 
@@ -128,13 +128,13 @@ public class JPANotification extends AbstractEntity<Long> 
implements Notificatio
     }
 
     @Override
-    public String getRoleAbout() {
-        return roleAbout;
+    public String getGroupAbout() {
+        return groupAbout;
     }
 
     @Override
-    public void setRoleAbout(final String roleAbout) {
-        this.roleAbout = roleAbout;
+    public void setGroupAbout(final String groupAbout) {
+        this.groupAbout = groupAbout;
     }
 
     @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/JPAttributableUtilFactory.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java
index 427e828..8eaf54e 100644
--- 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAttributableUtilFactory.java
@@ -24,7 +24,7 @@ import 
org.apache.syncope.core.persistence.api.entity.AttributableUtil;
 import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory;
 import org.apache.syncope.core.persistence.api.entity.conf.Conf;
 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.identityconnectors.framework.common.objects.ObjectClass;
 import org.springframework.stereotype.Component;
@@ -49,7 +49,7 @@ public class JPAttributableUtilFactory implements 
AttributableUtilFactory {
             type = AttributableType.USER;
         }
         if (ObjectClass.GROUP.equals(objectClass)) {
-            type = AttributableType.ROLE;
+            type = AttributableType.GROUP;
         }
 
         if (type == null) {
@@ -65,8 +65,8 @@ public class JPAttributableUtilFactory implements 
AttributableUtilFactory {
         if (attributable instanceof User) {
             type = AttributableType.USER;
         }
-        if (attributable instanceof Role) {
-            type = AttributableType.ROLE;
+        if (attributable instanceof Group) {
+            type = AttributableType.GROUP;
         }
         if (attributable instanceof Membership) {
             type = AttributableType.MEMBERSHIP;

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/JPAGDerAttr.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttr.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttr.java
new file mode 100644
index 0000000..7a160cf
--- /dev/null
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttr.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.entity.group;
+
+import javax.persistence.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.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.Group;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttr;
+
+@Entity
+@Table(name = JPAGDerAttr.TABLE)
+public class JPAGDerAttr extends AbstractDerAttr implements GDerAttr {
+
+    private static final long serialVersionUID = 8007080005675899946L;
+
+    public static final String TABLE = "GDerAttr";
+
+    @ManyToOne
+    private JPAGroup owner;
+
+    @Column(nullable = false)
+    @OneToOne(cascade = CascadeType.MERGE)
+    private JPAGDerAttrTemplate template;
+
+    @Override
+    public Group getOwner() {
+        return owner;
+    }
+
+    @Override
+    public void setOwner(final Attributable<?, ?, ?> owner) {
+        checkType(owner, JPAGroup.class);
+        this.owner = (JPAGroup) owner;
+    }
+
+    @Override
+    public GDerAttrTemplate getTemplate() {
+        return template;
+    }
+
+    @Override
+    public void setTemplate(final GDerAttrTemplate template) {
+        checkType(template, JPAGDerAttrTemplate.class);
+        this.template = (JPAGDerAttrTemplate) template;
+    }
+
+    @Override
+    public GDerSchema getSchema() {
+        return template == null ? null : template.getSchema();
+    }
+
+    @Override
+    public void setSchema(final DerSchema schema) {
+        LOG.warn("This is group 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/group/JPAGDerAttrTemplate.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttrTemplate.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttrTemplate.java
new file mode 100644
index 0000000..427d91b
--- /dev/null
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttrTemplate.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.entity.group;
+
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+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.Group;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttrTemplate;
+
+@Entity
+@Table(name = JPAGDerAttrTemplate.TABLE)
+public class JPAGDerAttrTemplate extends AbstractDerAttrTemplate<GDerSchema> 
implements GDerAttrTemplate {
+
+    private static final long serialVersionUID = 624868884107016649L;
+
+    public static final String TABLE = "GDerAttrTemplate";
+
+    @ManyToOne
+    private JPAGroup owner;
+
+    @ManyToOne
+    @JoinColumn(name = "schema_name")
+    private JPAGDerSchema schema;
+
+    @Override
+    public GDerSchema getSchema() {
+        return schema;
+    }
+
+    @Override
+    public void setSchema(final GDerSchema schema) {
+        checkType(schema, JPAGDerSchema.class);
+        this.schema = (JPAGDerSchema) schema;
+    }
+
+    @Override
+    public Group getOwner() {
+        return owner;
+    }
+
+    @Override
+    public void setOwner(final Group owner) {
+        checkType(owner, JPAGroup.class);
+        this.owner = (JPAGroup) owner;
+    }
+}

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

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/JPAGMapping.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMapping.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMapping.java
new file mode 100644
index 0000000..dd2679d
--- /dev/null
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMapping.java
@@ -0,0 +1,103 @@
+/*
+ * 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.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.group.GMapping;
+import org.apache.syncope.core.persistence.api.entity.group.GMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractMapping;
+import org.apache.syncope.core.persistence.jpa.entity.JPAExternalResource;
+
+@Entity
+@Table(name = JPAGMapping.TABLE)
+public class JPAGMapping extends AbstractMapping<GMappingItem> implements 
GMapping {
+
+    public static final String TABLE = "GMapping";
+
+    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<JPAGMappingItem> items;
+
+    public JPAGMapping() {
+        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 GMappingItem item) {
+        checkType(item, JPAGMappingItem.class);
+        this.addAccountIdItem((JPAGMappingItem) item);
+    }
+
+    @Override
+    public List<? extends GMappingItem> getItems() {
+        return items;
+    }
+
+    @Override
+    public boolean addItem(final GMappingItem item) {
+        checkType(item, JPAGMappingItem.class);
+        return items.contains((JPAGMappingItem) item) || 
items.add((JPAGMappingItem) item);
+    }
+
+    @Override
+    public boolean removeItem(final GMappingItem item) {
+        checkType(item, JPAGMappingItem.class);
+        return items.remove((JPAGMappingItem) 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/group/JPAGMappingItem.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMappingItem.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMappingItem.java
new file mode 100644
index 0000000..2e3dd8e
--- /dev/null
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMappingItem.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.entity.group;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.Mapping;
+import org.apache.syncope.core.persistence.api.entity.group.GMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractMappingItem;
+
+@Entity
+@Table(name = JPAGMappingItem.TABLE)
+public class JPAGMappingItem extends AbstractMappingItem implements 
GMappingItem {
+
+    public static final String TABLE = "GMappingItem";
+
+    private static final long serialVersionUID = -2670787666933476166L;
+
+    @Id
+    private Long id;
+
+    @ManyToOne
+    private JPAGMapping mapping;
+
+    @Override
+    public Long getKey() {
+        return id;
+    }
+
+    @Override
+    public Mapping<GMappingItem> getMapping() {
+        return mapping;
+    }
+
+    @Override
+    public void setMapping(final Mapping<?> mapping) {
+        checkType(mapping, JPAGMapping.class);
+        this.mapping = (JPAGMapping) 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/group/JPAGPlainAttr.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttr.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttr.java
new file mode 100644
index 0000000..e4f8f06
--- /dev/null
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttr.java
@@ -0,0 +1,140 @@
+/*
+ * 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.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.group.GPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate;
+import 
org.apache.syncope.core.persistence.api.entity.group.GPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttr;
+
+@Entity
+@Table(name = JPAGPlainAttr.TABLE)
+public class JPAGPlainAttr extends AbstractPlainAttr implements GPlainAttr {
+
+    private static final long serialVersionUID = 2848159565890995780L;
+
+    public static final String TABLE = "GPlainAttr";
+
+    @Id
+    private Long id;
+
+    @ManyToOne(fetch = FetchType.EAGER)
+    private JPAGroup owner;
+
+    @Column(nullable = false)
+    @OneToOne(cascade = CascadeType.MERGE)
+    private JPAGPlainAttrTemplate template;
+
+    @OneToMany(cascade = CascadeType.MERGE, orphanRemoval = true, mappedBy = 
"attribute")
+    @Valid
+    private List<JPAGPlainAttrValue> values;
+
+    @OneToOne(cascade = CascadeType.ALL, mappedBy = "attribute")
+    @Valid
+    private JPAGPlainAttrUniqueValue uniqueValue;
+
+    public JPAGPlainAttr() {
+        super();
+        values = new ArrayList<>();
+    }
+
+    @Override
+    public Long getKey() {
+        return id;
+    }
+
+    @Override
+    public Group getOwner() {
+        return owner;
+    }
+
+    @Override
+    public void setOwner(final Attributable<?, ?, ?> owner) {
+        checkType(owner, JPAGroup.class);
+        this.owner = (JPAGroup) owner;
+    }
+
+    @Override
+    public GPlainAttrTemplate getTemplate() {
+        return template;
+    }
+
+    @Override
+    public void setTemplate(final GPlainAttrTemplate template) {
+        checkType(template, JPAGPlainAttrTemplate.class);
+        this.template = (JPAGPlainAttrTemplate) template;
+    }
+
+    @Override
+    public GPlainSchema getSchema() {
+        return template == null ? null : template.getSchema();
+    }
+
+    @Override
+    public void setSchema(final PlainSchema schema) {
+        LOG.warn("This is group attribute, set template to select schema");
+    }
+
+    @Override
+    protected boolean addValue(final PlainAttrValue attrValue) {
+        checkType(attrValue, JPAGPlainAttrValue.class);
+        return values.add((JPAGPlainAttrValue) attrValue);
+    }
+
+    @Override
+    public boolean removeValue(final PlainAttrValue attrValue) {
+        checkType(attrValue, JPAGPlainAttrValue.class);
+        return values.remove((JPAGPlainAttrValue) attrValue);
+    }
+
+    @Override
+    public List<? extends GPlainAttrValue> getValues() {
+        return values;
+    }
+
+    @Override
+    public GPlainAttrUniqueValue getUniqueValue() {
+        return uniqueValue;
+    }
+
+    @Override
+    public void setUniqueValue(final PlainAttrUniqueValue uniqueValue) {
+        checkType(owner, JPAGPlainAttrUniqueValue.class);
+        this.uniqueValue = (JPAGPlainAttrUniqueValue) 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/group/JPAGPlainAttrTemplate.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrTemplate.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrTemplate.java
new file mode 100644
index 0000000..2af988e
--- /dev/null
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrTemplate.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.entity.group;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import 
org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrTemplate;
+
+@Entity
+@Table(name = JPAGPlainAttrTemplate.TABLE)
+public class JPAGPlainAttrTemplate extends 
AbstractPlainAttrTemplate<GPlainSchema> implements GPlainAttrTemplate {
+
+    private static final long serialVersionUID = 6943917051517266268L;
+
+    public static final String TABLE = "GPlainAttrTemplate";
+
+    @Id
+    private Long id;
+
+    @ManyToOne
+    private JPAGroup owner;
+
+    @Override
+    public Long getKey() {
+        return id;
+    }
+
+    @ManyToOne
+    @JoinColumn(name = "schema_name")
+    private JPAGPlainSchema schema;
+
+    @Override
+    public GPlainSchema getSchema() {
+        return schema;
+    }
+
+    @Override
+    public void setSchema(final GPlainSchema schema) {
+        checkType(schema, JPAGPlainSchema.class);
+        this.schema = (JPAGPlainSchema) schema;
+    }
+
+    @Override
+    public Group getOwner() {
+        return owner;
+    }
+
+    @Override
+    public void setOwner(final Group owner) {
+        checkType(owner, JPAGroup.class);
+        this.owner = (JPAGroup) owner;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrUniqueValue.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrUniqueValue.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrUniqueValue.java
new file mode 100644
index 0000000..f361c03
--- /dev/null
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrUniqueValue.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.entity.group;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.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.group.GPlainAttr;
+import 
org.apache.syncope.core.persistence.api.entity.group.GPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue;
+
+@Entity
+@Table(name = JPAGPlainAttrUniqueValue.TABLE)
+public class JPAGPlainAttrUniqueValue extends AbstractPlainAttrValue 
implements GPlainAttrUniqueValue {
+
+    private static final long serialVersionUID = 4681561795607192855L;
+
+    public static final String TABLE = "GPlainAttrUniqueValue";
+
+    @Id
+    private Long id;
+
+    @OneToOne(optional = false)
+    private JPAGPlainAttr attribute;
+
+    @ManyToOne(optional = false)
+    @JoinColumn(name = "schema_name")
+    private JPAGPlainSchema schema;
+
+    @Override
+    public Long getKey() {
+        return id;
+    }
+
+    @Override
+    public GPlainAttr getAttr() {
+        return attribute;
+    }
+
+    @Override
+    public void setAttr(final PlainAttr attr) {
+        checkType(attr, JPAGPlainAttr.class);
+        this.attribute = (JPAGPlainAttr) attr;
+    }
+
+    @Override
+    public GPlainSchema getSchema() {
+        return schema;
+    }
+
+    @Override
+    public void setSchema(final PlainSchema schema) {
+        checkType(schema, JPAGPlainSchema.class);
+        this.schema = (JPAGPlainSchema) 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/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
new file mode 100644
index 0000000..ed93477
--- /dev/null
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrValue.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.entity.group;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.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.group.GPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
+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;
+
+    public static final String TABLE = "GPlainAttrValue";
+
+    @Id
+    private Long id;
+
+    @ManyToOne
+    @NotNull
+    private JPAGPlainAttr attribute;
+
+    @Override
+    public Long getKey() {
+        return id;
+    }
+
+    @Override
+    public GPlainAttr getAttr() {
+        return attribute;
+    }
+
+    @Override
+    public void setAttr(final PlainAttr attr) {
+        checkType(attr, JPAGPlainAttr.class);
+        this.attribute = (JPAGPlainAttr) 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/group/JPAGPlainSchema.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainSchema.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainSchema.java
new file mode 100644
index 0000000..684be57
--- /dev/null
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainSchema.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.entity.group;
+
+import javax.persistence.Cacheable;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainSchema;
+
+@Entity
+@Table(name = JPAGPlainSchema.TABLE)
+@Cacheable
+public class JPAGPlainSchema extends AbstractPlainSchema implements 
GPlainSchema {
+
+    private static final long serialVersionUID = -7417234690221851342L;
+
+    public static final String TABLE = "GPlainSchema";
+
+}

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/JPAGVirAttr.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttr.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttr.java
new file mode 100644
index 0000000..95d9a37
--- /dev/null
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttr.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.entity.group;
+
+import javax.persistence.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.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.jpa.entity.AbstractVirAttr;
+
+@Entity
+@Table(name = JPAGVirAttr.TABLE)
+public class JPAGVirAttr extends AbstractVirAttr implements GVirAttr {
+
+    private static final long serialVersionUID = -1747430556914428649L;
+
+    public static final String TABLE = "GVirAttr";
+
+    @ManyToOne
+    private JPAGroup owner;
+
+    @Column(nullable = false)
+    @OneToOne(cascade = CascadeType.MERGE)
+    private JPAGVirAttrTemplate template;
+
+    @Override
+    public Group getOwner() {
+        return owner;
+    }
+
+    @Override
+    public void setOwner(final Attributable<?, ?, ?> owner) {
+        checkType(owner, JPAGroup.class);
+        this.owner = (JPAGroup) owner;
+    }
+
+    @Override
+    public GVirAttrTemplate getTemplate() {
+        return template;
+    }
+
+    @Override
+    public void setTemplate(final GVirAttrTemplate template) {
+        checkType(template, JPAGVirAttrTemplate.class);
+        this.template = (JPAGVirAttrTemplate) template;
+    }
+
+    @Override
+    public GVirSchema getSchema() {
+        return template == null ? null : template.getSchema();
+    }
+
+    @Override
+    public void setSchema(final VirSchema schema) {
+        LOG.warn("This is group 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/group/JPAGVirAttrTemplate.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttrTemplate.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttrTemplate.java
new file mode 100644
index 0000000..72f9fd3
--- /dev/null
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttrTemplate.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.entity.group;
+
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+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.jpa.entity.AbstractVirAttrTemplate;
+
+@Entity
+@Table(name = JPAGVirAttrTemplate.TABLE)
+public class JPAGVirAttrTemplate extends AbstractVirAttrTemplate<GVirSchema> 
implements GVirAttrTemplate {
+
+    private static final long serialVersionUID = 4896495904794493479L;
+
+    public static final String TABLE = "GVirAttrTemplate";
+
+    @ManyToOne
+    private JPAGroup owner;
+
+    @ManyToOne
+    @JoinColumn(name = "schema_name")
+    private JPAGVirSchema schema;
+
+    @Override
+    public GVirSchema getSchema() {
+        return schema;
+    }
+
+    @Override
+    public void setSchema(final GVirSchema schema) {
+        checkType(schema, JPAGVirSchema.class);
+        this.schema = (JPAGVirSchema) schema;
+    }
+
+    @Override
+    public Group getOwner() {
+        return owner;
+    }
+
+    @Override
+    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/group/JPAGVirSchema.java
----------------------------------------------------------------------
diff --git 
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirSchema.java
 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirSchema.java
new file mode 100644
index 0000000..6f735a8
--- /dev/null
+++ 
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirSchema.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.entity.group;
+
+import javax.persistence.Cacheable;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.group.GVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractVirSchema;
+
+@Entity
+@Table(name = JPAGVirSchema.TABLE)
+@Cacheable
+public class JPAGVirSchema extends AbstractVirSchema implements GVirSchema {
+
+    private static final long serialVersionUID = -2595041749349652939L;
+
+    public static final String TABLE = "GVirSchema";
+
+}

Reply via email to