syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [15/24] syncope git commit: [SYNCOPE-822] UUID keys
Date Tue, 19 Apr 2016 13:02:02 GMT
http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/conf/Conf.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/conf/Conf.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/conf/Conf.java
index 64c60d0..f17a1c2 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/conf/Conf.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/conf/Conf.java
@@ -20,10 +20,9 @@ package org.apache.syncope.core.persistence.api.entity.conf;
 
 import java.util.List;
 import org.apache.syncope.core.persistence.api.entity.Any;
+import org.apache.syncope.core.persistence.api.entity.ProvidedKeyEntity;
 
-public interface Conf extends Any<CPlainAttr> {
-
-    void setKey(Long key);
+public interface Conf extends Any<CPlainAttr>, ProvidedKeyEntity {
 
     @Override
     boolean add(CPlainAttr attr);

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/TypeExtension.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/TypeExtension.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/TypeExtension.java
index 450112f..effc2f5 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/TypeExtension.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/group/TypeExtension.java
@@ -23,7 +23,7 @@ import org.apache.syncope.core.persistence.api.entity.AnyType;
 import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
 import org.apache.syncope.core.persistence.api.entity.Entity;
 
-public interface TypeExtension extends Entity<Long> {
+public interface TypeExtension extends Entity {
 
     Group getGroup();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java
index 7b5147e..cb16679 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java
@@ -24,16 +24,14 @@ import org.apache.syncope.common.lib.types.ConnConfProperty;
 import org.apache.syncope.common.lib.types.ConnectorCapability;
 import org.apache.syncope.common.lib.types.TraceLevel;
 import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
-import org.apache.syncope.core.persistence.api.entity.AnnotatedEntity;
 import org.apache.syncope.core.persistence.api.entity.AnyType;
 import org.apache.syncope.core.persistence.api.entity.ConnInstance;
+import org.apache.syncope.core.persistence.api.entity.ProvidedKeyEntity;
 import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
 import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
 import org.identityconnectors.framework.common.objects.ObjectClass;
 
-public interface ExternalResource extends AnnotatedEntity<String> {
-
-    void setKey(String key);
+public interface ExternalResource extends ProvidedKeyEntity {
 
     ConnInstance getConnector();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/Mapping.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/Mapping.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/Mapping.java
index 02ac485..5c14f18 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/Mapping.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/Mapping.java
@@ -21,7 +21,7 @@ package org.apache.syncope.core.persistence.api.entity.resource;
 import java.util.List;
 import org.apache.syncope.core.persistence.api.entity.Entity;
 
-public interface Mapping extends Entity<Long> {
+public interface Mapping extends Entity {
 
     Provision getProvision();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/MappingItem.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/MappingItem.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/MappingItem.java
index 9f515ed..abbf69c 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/MappingItem.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/MappingItem.java
@@ -23,7 +23,7 @@ import org.apache.syncope.common.lib.types.IntMappingType;
 import org.apache.syncope.common.lib.types.MappingPurpose;
 import org.apache.syncope.core.persistence.api.entity.Entity;
 
-public interface MappingItem extends Entity<Long> {
+public interface MappingItem extends Entity {
 
     Mapping getMapping();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/Provision.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/Provision.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/Provision.java
index 30cd970..0a89878 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/Provision.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/Provision.java
@@ -25,7 +25,7 @@ import org.apache.syncope.core.persistence.api.entity.Entity;
 import org.identityconnectors.framework.common.objects.ObjectClass;
 import org.identityconnectors.framework.common.objects.SyncToken;
 
-public interface Provision extends Entity<Long> {
+public interface Provision extends Entity {
 
     ExternalResource getResource();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/NotificationTask.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/NotificationTask.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/NotificationTask.java
index 92fb6d2..f7d83d1 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/NotificationTask.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/NotificationTask.java
@@ -29,9 +29,9 @@ public interface NotificationTask extends Task {
 
     void setNotification(Notification notification);
 
-    Long getAnyKey();
+    String getAnyKey();
 
-    void setAnyKey(Long anyKey);
+    void setAnyKey(String anyKey);
 
     AnyTypeKind getAnyTypeKind();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PropagationTask.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PropagationTask.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PropagationTask.java
index 842cf86..4014fce 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PropagationTask.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PropagationTask.java
@@ -48,9 +48,9 @@ public interface PropagationTask extends Task {
 
     void setOperation(ResourceOperation operation);
 
-    Long getAnyKey();
+    String getAnyKey();
 
-    void setAnyKey(Long anyKey);
+    void setAnyKey(String anyKey);
 
     AnyTypeKind getAnyTypeKind();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PushTaskAnyFilter.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PushTaskAnyFilter.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PushTaskAnyFilter.java
index 76d54c2..8a00d57 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PushTaskAnyFilter.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PushTaskAnyFilter.java
@@ -21,7 +21,7 @@ package org.apache.syncope.core.persistence.api.entity.task;
 import org.apache.syncope.core.persistence.api.entity.AnyType;
 import org.apache.syncope.core.persistence.api.entity.Entity;
 
-public interface PushTaskAnyFilter extends Entity<Long> {
+public interface PushTaskAnyFilter extends Entity {
 
     PushTask getPushTask();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/Task.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/Task.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/Task.java
index 630daa9..708c2c8 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/Task.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/Task.java
@@ -21,7 +21,7 @@ package org.apache.syncope.core.persistence.api.entity.task;
 import java.util.List;
 import org.apache.syncope.core.persistence.api.entity.Entity;
 
-public interface Task extends Entity<Long> {
+public interface Task extends Entity {
 
     boolean add(TaskExec exec);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/SecurityQuestion.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/SecurityQuestion.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/SecurityQuestion.java
index 4b49e76..c0a1f9e 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/SecurityQuestion.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/SecurityQuestion.java
@@ -20,7 +20,7 @@ package org.apache.syncope.core.persistence.api.entity.user;
 
 import org.apache.syncope.core.persistence.api.entity.Entity;
 
-public interface SecurityQuestion extends Entity<Long> {
+public interface SecurityQuestion extends Entity {
 
     String getContent();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/User.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/User.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/User.java
index d1b94e7..b7e14bf 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/User.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/user/User.java
@@ -107,9 +107,9 @@ public interface User extends Any<UPlainAttr> {
 
     boolean add(URelationship relationship);
 
-    URelationship getRelationship(RelationshipType relationshipType, Long anyObjectKey);
+    URelationship getRelationship(RelationshipType relationshipType, String anyObjectKey);
 
-    Collection<? extends URelationship> getRelationships(Long anyObjectKey);
+    Collection<? extends URelationship> getRelationships(String anyObjectKey);
 
     Collection<? extends URelationship> getRelationships(RelationshipType relationshipType);
 
@@ -117,7 +117,7 @@ public interface User extends Any<UPlainAttr> {
 
     boolean add(UMembership membership);
 
-    UMembership getMembership(Long groupKey);
+    UMembership getMembership(String groupKey);
 
     List<? extends UMembership> getMemberships();
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java
index 79fe904..d5c7bcc 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java
@@ -93,25 +93,25 @@ public class SearchCondVisitor extends AbstractSearchConditionVisitor<SearchBean
                     switch (specialAttrName) {
                         case TYPE:
                             AnyTypeCond typeCond = new AnyTypeCond();
-                            typeCond.setAnyTypeName(value);
+                            typeCond.setAnyTypeKey(value);
                             leaf = SearchCond.getLeafCond(typeCond);
                             break;
 
                         case RESOURCES:
                             ResourceCond resourceCond = new ResourceCond();
-                            resourceCond.setResourceName(value);
+                            resourceCond.setResourceKey(value);
                             leaf = SearchCond.getLeafCond(resourceCond);
                             break;
 
                         case GROUPS:
                             MembershipCond groupCond = new MembershipCond();
-                            groupCond.setGroupKey(Long.valueOf(value));
+                            groupCond.setGroupKey(value);
                             leaf = SearchCond.getLeafCond(groupCond);
                             break;
 
                         case RELATIONSHIPS:
                             RelationshipCond relationshipCond = new RelationshipCond();
-                            relationshipCond.setAnyObjectKey(Long.valueOf(value));
+                            relationshipCond.setAnyObjectKey(value);
                             leaf = SearchCond.getLeafCond(relationshipCond);
                             break;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/search/SearchCondConverterTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/search/SearchCondConverterTest.java b/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/search/SearchCondConverterTest.java
index 05a8cdc..07c2d29 100644
--- a/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/search/SearchCondConverterTest.java
+++ b/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/search/SearchCondConverterTest.java
@@ -90,11 +90,12 @@ public class SearchCondConverterTest {
 
     @Test
     public void relationships() {
-        String fiqlExpression = new UserFiqlSearchConditionBuilder().inRelationships(1L).query();
-        assertEquals(SpecialAttr.RELATIONSHIPS + "==1", fiqlExpression);
+        String fiqlExpression = new UserFiqlSearchConditionBuilder().
+                inRelationships("ca20ffca-1305-442f-be9a-3723a0cd88ca").query();
+        assertEquals(SpecialAttr.RELATIONSHIPS + "==ca20ffca-1305-442f-be9a-3723a0cd88ca", fiqlExpression);
 
         RelationshipCond relationshipCond = new RelationshipCond();
-        relationshipCond.setAnyObjectKey(1L);
+        relationshipCond.setAnyObjectKey("ca20ffca-1305-442f-be9a-3723a0cd88ca");
         SearchCond simpleCond = SearchCond.getLeafCond(relationshipCond);
 
         assertEquals(simpleCond, SearchCondConverter.convert(fiqlExpression));
@@ -119,11 +120,12 @@ public class SearchCondConverterTest {
 
     @Test
     public void groups() {
-        String fiqlExpression = new UserFiqlSearchConditionBuilder().inGroups(1L).query();
-        assertEquals(SpecialAttr.GROUPS + "==1", fiqlExpression);
+        String fiqlExpression = new UserFiqlSearchConditionBuilder().
+                inGroups("e7ff94e8-19c9-4f0a-b8b7-28327edbf6ed").query();
+        assertEquals(SpecialAttr.GROUPS + "==e7ff94e8-19c9-4f0a-b8b7-28327edbf6ed", fiqlExpression);
 
         MembershipCond groupCond = new MembershipCond();
-        groupCond.setGroupKey(1L);
+        groupCond.setGroupKey("e7ff94e8-19c9-4f0a-b8b7-28327edbf6ed");
         SearchCond simpleCond = SearchCond.getLeafCond(groupCond);
 
         assertEquals(simpleCond, SearchCondConverter.convert(fiqlExpression));
@@ -147,7 +149,7 @@ public class SearchCondConverterTest {
         assertEquals(SpecialAttr.RESOURCES + "==resource-ldap", fiqlExpression);
 
         ResourceCond resCond = new ResourceCond();
-        resCond.setResourceName("resource-ldap");
+        resCond.setResourceKey("resource-ldap");
         SearchCond simpleCond = SearchCond.getLeafCond(resCond);
 
         assertEquals(simpleCond, SearchCondConverter.convert(fiqlExpression));
@@ -171,7 +173,7 @@ public class SearchCondConverterTest {
         assertEquals(SpecialAttr.TYPE + "==PRINTER", fiqlExpression);
 
         AnyTypeCond acond = new AnyTypeCond();
-        acond.setAnyTypeName("PRINTER");
+        acond.setAnyTypeKey("PRINTER");
         SearchCond simpleCond = SearchCond.getLeafCond(acond);
 
         assertEquals(simpleCond, SearchCondConverter.convert(fiqlExpression));

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/pom.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/pom.xml b/core/persistence-jpa/pom.xml
index 412be1c..a902aa7 100644
--- a/core/persistence-jpa/pom.xml
+++ b/core/persistence-jpa/pom.xml
@@ -55,6 +55,10 @@ under the License.
       <groupId>org.apache.openjpa</groupId>
       <artifactId>openjpa-persistence-jdbc</artifactId>
     </dependency>
+    <dependency>
+      <groupId>com.fasterxml.uuid</groupId>
+      <artifactId>java-uuid-generator</artifactId>
+    </dependency>
     
     <dependency>
       <groupId>org.apache.commons</groupId>
@@ -157,7 +161,7 @@ under the License.
           </dependency>
         </dependencies>
         <configuration>
-          <persistenceXmlFile>${project.basedir}/src/test/resources/META-INF/persistence-enhance.xml</persistenceXmlFile> 
+          <persistenceXmlFile>${project.basedir}/src/main/resources/persistence-enhance.xml</persistenceXmlFile> 
           <includes>org/apache/syncope/core/persistence/jpa/entity/**/*.class</includes>
           <connectionDriverName>org.springframework.jdbc.datasource.DriverManagerDataSource</connectionDriverName>
           <connectionProperties>

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
index 6f64a88..d09b765 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
@@ -63,7 +63,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
-public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A, Long> implements AnyDAO<A> {
+public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A> implements AnyDAO<A> {
 
     @Autowired
     protected PlainSchemaDAO plainSchemaDAO;
@@ -91,7 +91,7 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A, Lo
 
     @Transactional(readOnly = true)
     @Override
-    public A authFind(final Long key) {
+    public A authFind(final String key) {
         if (key == null) {
             throw new NotFoundException("Null key");
         }
@@ -110,7 +110,7 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A, Lo
     @Transactional(readOnly = true)
     @Override
     @SuppressWarnings("unchecked")
-    public A find(final Long key) {
+    public A find(final String key) {
         return (A) entityManager().find(getAnyUtils().anyClass(), key);
     }
 
@@ -133,7 +133,7 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A, Lo
 
     private Query findByAttrValueQuery(final String entityName) {
         return entityManager().createQuery("SELECT e FROM " + entityName + " e"
-                + " WHERE e.attribute.schema.name = :schemaName AND (e.stringValue IS NOT NULL"
+                + " WHERE e.attribute.schema.key = :schemaKey AND (e.stringValue IS NOT NULL"
                 + " AND e.stringValue = :stringValue)"
                 + " OR (e.booleanValue IS NOT NULL AND e.booleanValue = :booleanValue)"
                 + " OR (e.dateValue IS NOT NULL AND e.dateValue = :dateValue)"
@@ -143,10 +143,10 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A, Lo
 
     @Override
     @SuppressWarnings("unchecked")
-    public List<A> findByAttrValue(final String schemaName, final PlainAttrValue attrValue) {
-        PlainSchema schema = plainSchemaDAO.find(schemaName);
+    public List<A> findByAttrValue(final String schemaKey, final PlainAttrValue attrValue) {
+        PlainSchema schema = plainSchemaDAO.find(schemaKey);
         if (schema == null) {
-            LOG.error("Invalid schema name '{}'", schemaName);
+            LOG.error("Invalid schema name '{}'", schemaKey);
             return Collections.<A>emptyList();
         }
 
@@ -154,7 +154,7 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A, Lo
                 ? getAnyUtils().plainAttrUniqueValueClass().getName()
                 : getAnyUtils().plainAttrValueClass().getName();
         Query query = findByAttrValueQuery(entityName);
-        query.setParameter("schemaName", schemaName);
+        query.setParameter("schemaKey", schemaKey);
         query.setParameter("stringValue", attrValue.getStringValue());
         query.setParameter("booleanValue", attrValue.getBooleanValue() == null
                 ? null
@@ -179,18 +179,18 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A, Lo
     }
 
     @Override
-    public A findByAttrUniqueValue(final String schemaName, final PlainAttrValue attrUniqueValue) {
-        PlainSchema schema = plainSchemaDAO.find(schemaName);
+    public A findByAttrUniqueValue(final String schemaKey, final PlainAttrValue attrUniqueValue) {
+        PlainSchema schema = plainSchemaDAO.find(schemaKey);
         if (schema == null) {
-            LOG.error("Invalid schema name '{}'", schemaName);
+            LOG.error("Invalid schema name '{}'", schemaKey);
             return null;
         }
         if (!schema.isUniqueConstraint()) {
-            LOG.error("This schema has not unique constraint: '{}'", schemaName);
+            LOG.error("This schema has not unique constraint: '{}'", schemaKey);
             return null;
         }
 
-        List<A> result = findByAttrValue(schemaName, attrUniqueValue);
+        List<A> result = findByAttrValue(schemaKey, attrUniqueValue);
         return result.isEmpty()
                 ? null
                 : result.iterator().next();
@@ -294,8 +294,8 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A, Lo
                 // verify schema existence and get schema type
                 PlainSchema schema = plainSchemaDAO.find(identifiers.get(i));
                 if (schema == null) {
-                    LOG.error("Invalid schema name '{}'", identifiers.get(i));
-                    throw new IllegalArgumentException("Invalid schema name " + identifiers.get(i));
+                    LOG.error("Invalid schema key '{}'", identifiers.get(i));
+                    throw new IllegalArgumentException("Invalid schema key " + identifiers.get(i));
                 }
 
                 // clear builder
@@ -304,13 +304,13 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A, Lo
                 bld.append("(");
 
                 // set schema name
-                bld.append("s.name = '").append(identifiers.get(i)).append("'");
+                bld.append("s.key = '").append(identifiers.get(i)).append("'");
 
                 bld.append(" AND ");
 
-                bld.append("s.name = a.schema_name").append(" AND ");
+                bld.append("s.key = a.schema_key").append(" AND ");
 
-                bld.append("a.id = v.attribute_id");
+                bld.append("a.key = v.attribute_key");
 
                 bld.append(" AND ");
 
@@ -346,10 +346,10 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A, Lo
     }
 
     @Override
-    public List<A> findByDerAttrValue(final String schemaName, final String value) {
-        DerSchema schema = derSchemaDAO.find(schemaName);
+    public List<A> findByDerAttrValue(final String schemaKey, final String value) {
+        DerSchema schema = derSchemaDAO.find(schemaKey);
         if (schema == null) {
-            LOG.error("Invalid schema name '{}'", schemaName);
+            LOG.error("Invalid schema name '{}'", schemaKey);
             return Collections.<A>emptyList();
         }
 
@@ -360,10 +360,10 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A, Lo
         for (String clause : getWhereClause(schema.getExpression(), value)) {
             if (querystring.length() > 0) {
                 subquery = true;
-                querystring.append(" AND a.owner_id IN ( ");
+                querystring.append(" AND a.owner_key IN ( ");
             }
 
-            querystring.append("SELECT a.owner_id ").
+            querystring.append("SELECT a.owner_key ").
                     append("FROM ").append(getAnyUtils().plainAttrClass().getSimpleName().substring(3)).append(" a, ").
                     append(getAnyUtils().plainAttrValueClass().getSimpleName().substring(3)).append(" v, ").
                     append(PlainSchema.class.getSimpleName()).append(" s ").
@@ -378,7 +378,7 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A, Lo
 
         List<A> result = new ArrayList<>();
         for (Object anyKey : query.getResultList()) {
-            A any = find(Long.parseLong(anyKey.toString()));
+            A any = find(anyKey.toString());
             if (!result.contains(any)) {
                 result.add(any);
             }
@@ -405,7 +405,7 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A, Lo
 
     private SearchCond getAllMatchingCond() {
         AnyCond idCond = new AnyCond(AttributeCond.Type.ISNOTNULL);
-        idCond.setSchema("id");
+        idCond.setSchema("key");
         return SearchCond.getLeafCond(idCond);
     }
 
@@ -464,7 +464,7 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A, Lo
     }
 
     @Override
-    public void delete(final Long key) {
+    public void delete(final String key) {
         A any = find(key);
         if (any == null) {
             return;

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractDAO.java
index acbde6e..5b16737 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractDAO.java
@@ -29,7 +29,7 @@ import org.springframework.beans.factory.annotation.Configurable;
 import org.springframework.orm.jpa.EntityManagerFactoryUtils;
 
 @Configurable
-public abstract class AbstractDAO<E extends Entity<KEY>, KEY> implements DAO<E, KEY> {
+public abstract class AbstractDAO<E extends Entity> implements DAO<E> {
 
     protected static final Logger LOG = LoggerFactory.getLogger(DAO.class);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnyObjectDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnyObjectDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnyObjectDAO.java
index a000511..37dcccf 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnyObjectDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnyObjectDAO.java
@@ -184,8 +184,8 @@ public class JPAAnyObjectDAO extends AbstractAnyDAO<AnyObject> implements AnyObj
 
     @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = true)
     @Override
-    public Collection<Long> findAllGroupKeys(final AnyObject anyObject) {
-        return CollectionUtils.collect(findAllGroups(anyObject), EntityUtils.<Long, Group>keyTransformer());
+    public Collection<String> findAllGroupKeys(final AnyObject anyObject) {
+        return CollectionUtils.collect(findAllGroups(anyObject), EntityUtils.<Group>keyTransformer());
     }
 
     @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = true)
@@ -204,7 +204,7 @@ public class JPAAnyObjectDAO extends AbstractAnyDAO<AnyObject> implements AnyObj
     @Override
     public Collection<String> findAllResourceNames(final AnyObject anyObject) {
         return CollectionUtils.collect(
-                findAllResources(anyObject), EntityUtils.<String, ExternalResource>keyTransformer());
+                findAllResources(anyObject), EntityUtils.<ExternalResource>keyTransformer());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java
index 88c6cbf..9504360 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java
@@ -72,9 +72,9 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ReflectionUtils;
 
 @Repository
-public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySearchDAO {
+public class JPAAnySearchDAO extends AbstractDAO<Any<?>> implements AnySearchDAO {
 
-    private static final String EMPTY_QUERY = "SELECT any_id FROM user_search_attr WHERE 1=2";
+    private static final String EMPTY_QUERY = "SELECT any_key FROM user_search_attr WHERE 1=2";
 
     @Autowired
     private RealmDAO realmDAO;
@@ -94,31 +94,35 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
     @Autowired
     private AnyUtilsFactory anyUtilsFactory;
 
-    private String getAdminRealmsFilter(final Set<String> adminRealms, final SearchSupport svs) {
-        Set<Long> realmKeys = new HashSet<>();
+    private String getAdminRealmsFilter(
+            final Set<String> adminRealms,
+            final SearchSupport svs,
+            final List<Object> parameters) {
+
+        Set<String> realmKeys = new HashSet<>();
         for (String realmPath : RealmUtils.normalize(adminRealms)) {
-            Realm realm = realmDAO.find(realmPath);
+            Realm realm = realmDAO.findByFullPath(realmPath);
             if (realm == null) {
                 LOG.warn("Ignoring invalid realm {}", realmPath);
             } else {
                 CollectionUtils.collect(
-                        realmDAO.findDescendants(realm), EntityUtils.<Long, Realm>keyTransformer(), realmKeys);
+                        realmDAO.findDescendants(realm), EntityUtils.<Realm>keyTransformer(), realmKeys);
             }
         }
 
         StringBuilder adminRealmFilter = new StringBuilder().
-                append("SELECT any_id FROM ").append(svs.field().name).
-                append(" WHERE realm_id IN (SELECT id AS realm_id FROM Realm");
+                append("SELECT any_key FROM ").append(svs.field().name).
+                append(" WHERE realm_key IN (SELECT key AS realm_key FROM Realm");
 
         boolean firstRealm = true;
-        for (Long realmKey : realmKeys) {
+        for (String realmKey : realmKeys) {
             if (firstRealm) {
                 adminRealmFilter.append(" WHERE");
                 firstRealm = false;
             } else {
                 adminRealmFilter.append(" OR");
             }
-            adminRealmFilter.append(" id = ").append(realmKey);
+            adminRealmFilter.append(" key=?").append(setParameter(parameters, realmKey));
         }
 
         adminRealmFilter.append(')');
@@ -135,13 +139,13 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
         StringBuilder queryString = getQuery(searchCondition, parameters, svs);
 
         // 2. take into account administrative realms
-        queryString.insert(0, "SELECT u.any_id FROM (");
-        queryString.append(") u WHERE any_id IN (");
-        queryString.append(getAdminRealmsFilter(adminRealms, svs)).append(')');
+        queryString.insert(0, "SELECT u.any_key FROM (");
+        queryString.append(") u WHERE any_key IN (");
+        queryString.append(getAdminRealmsFilter(adminRealms, svs, parameters)).append(')');
 
         // 3. prepare the COUNT query
-        queryString.insert(0, "SELECT COUNT(any_id) FROM (");
-        queryString.append(") count_any_id");
+        queryString.insert(0, "SELECT COUNT(any_key) FROM (");
+        queryString.append(") count_any_key");
 
         Query countQuery = entityManager().createNativeQuery(queryString.toString());
         fillWithParameters(countQuery, parameters);
@@ -209,8 +213,8 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
             matches = false;
         } else {
             // 2. take into account the passed user
-            queryString.insert(0, "SELECT u.any_id FROM (");
-            queryString.append(") u WHERE any_id=?").append(setParameter(parameters, any.getKey()));
+            queryString.insert(0, "SELECT u.any_key FROM (");
+            queryString.append(") u WHERE any_key=?").append(setParameter(parameters, any.getKey()));
 
             // 3. prepare the search query
             Query query = entityManager().createNativeQuery(queryString.toString());
@@ -250,7 +254,7 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
     }
 
     private StringBuilder buildSelect(final OrderBySupport orderBySupport) {
-        final StringBuilder select = new StringBuilder("SELECT u.any_id");
+        final StringBuilder select = new StringBuilder("SELECT u.any_key");
 
         for (OrderBySupport.Item obs : orderBySupport.items) {
             select.append(',').append(obs.select);
@@ -275,7 +279,7 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
         }
         where.append(" WHERE ");
         for (SearchSupport.SearchView searchView : orderBySupport.views) {
-            where.append("u.any_id=").append(searchView.alias).append(".any_id AND ");
+            where.append("u.any_key=").append(searchView.alias).append(".any_key AND ");
         }
 
         for (OrderBySupport.Item obs : orderBySupport.items) {
@@ -283,7 +287,7 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
                 where.append(obs.where).append(" AND ");
             }
         }
-        where.append("u.any_id IN (");
+        where.append("u.any_key IN (");
 
         return where;
     }
@@ -312,8 +316,7 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
         for (OrderByClause clause : orderByClauses) {
             OrderBySupport.Item obs = new OrderBySupport.Item();
 
-            // Manage difference among external key attribute and internal JPA @Id
-            String fieldName = "key".equals(clause.getField()) ? "id" : clause.getField();
+            String fieldName = clause.getField();
 
             Field anyField = ReflectionUtils.findField(attrUtils.anyClass(), fieldName);
             if (anyField == null) {
@@ -327,7 +330,7 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
                                 append(" AS ").append(fieldName).toString();
                         obs.where = new StringBuilder().
                                 append(svs.uniqueAttr().alias).
-                                append(".schema_name='").append(fieldName).append("'").toString();
+                                append(".schema_key='").append(fieldName).append("'").toString();
                         obs.orderBy = fieldName + " " + clause.getDirection().name();
                     } else {
                         orderBySupport.views.add(svs.attr());
@@ -337,7 +340,7 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
                                 append(" AS ").append(fieldName).toString();
                         obs.where = new StringBuilder().
                                 append(svs.attr().alias).
-                                append(".schema_name='").append(fieldName).append("'").toString();
+                                append(".schema_key='").append(fieldName).append("'").toString();
                         obs.orderBy = fieldName + " " + clause.getDirection().name();
                     }
                 }
@@ -380,7 +383,7 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
             queryString.append(')').append(buildWhere(orderBySupport, typeKind));
         }
         queryString.
-                append(getAdminRealmsFilter(adminRealms, svs)).append(')').
+                append(getAdminRealmsFilter(adminRealms, svs, parameters)).append(')').
                 append(buildOrderBy(orderBySupport));
 
         // 3. prepare the search query
@@ -400,9 +403,9 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
         List<T> result = new ArrayList<>();
 
         for (Object anyKey : query.getResultList()) {
-            long actualKey = anyKey instanceof Object[]
-                    ? ((Number) ((Object[]) anyKey)[0]).longValue()
-                    : ((Number) anyKey).longValue();
+            String actualKey = anyKey instanceof Object[]
+                    ? (String) ((Object[]) anyKey)[0]
+                    : ((String) anyKey);
 
             T any = typeKind == AnyTypeKind.USER
                     ? (T) userDAO.find(actualKey)
@@ -410,7 +413,7 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
                             ? (T) groupDAO.find(actualKey)
                             : (T) anyObjectDAO.find(actualKey);
             if (any == null) {
-                LOG.error("Could not find {} with id {}, even though returned by the native query",
+                LOG.error("Could not find {} with key {}, even though returned by the native query",
                         typeKind, actualKey);
             } else if (!result.contains(any)) {
                 result.add(any);
@@ -464,14 +467,14 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
 
             case AND:
                 query.append(getQuery(nodeCond.getLeftNodeCond(), parameters, svs)).
-                        append(" AND any_id IN ( ").
+                        append(" AND any_key IN ( ").
                         append(getQuery(nodeCond.getRightNodeCond(), parameters, svs)).
                         append(")");
                 break;
 
             case OR:
                 query.append(getQuery(nodeCond.getLeftNodeCond(), parameters, svs)).
-                        append(" OR any_id IN ( ").
+                        append(" OR any_key IN ( ").
                         append(getQuery(nodeCond.getRightNodeCond(), parameters, svs)).
                         append(")");
                 break;
@@ -485,8 +488,8 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
     private String getQuery(final AnyTypeCond cond, final boolean not, final List<Object> parameters,
             final SearchSupport svs) {
 
-        StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM ").
-                append(svs.field().name).append(" WHERE type_name");
+        StringBuilder query = new StringBuilder("SELECT DISTINCT any_key FROM ").
+                append(svs.field().name).append(" WHERE type_key");
 
         if (not) {
             query.append("<>");
@@ -494,7 +497,7 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
             query.append('=');
         }
 
-        query.append('?').append(setParameter(parameters, cond.getAnyTypeName()));
+        query.append('?').append(setParameter(parameters, cond.getAnyTypeKey()));
 
         return query.toString();
     }
@@ -502,19 +505,19 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
     private String getQuery(final RelationshipTypeCond cond, final boolean not, final List<Object> parameters,
             final SearchSupport svs) {
 
-        StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM ").
+        StringBuilder query = new StringBuilder("SELECT DISTINCT any_key FROM ").
                 append(svs.field().name).append(" WHERE ");
 
         if (not) {
-            query.append("any_id NOT IN (");
+            query.append("any_key NOT IN (");
         } else {
-            query.append("any_id IN (");
+            query.append("any_key IN (");
         }
 
-        query.append("SELECT any_id ").append("FROM ").
+        query.append("SELECT any_key ").append("FROM ").
                 append(svs.relationship().name).
                 append(" WHERE type=?").append(setParameter(parameters, cond.getRelationshipTypeKey())).
-                append(" UNION SELECT right_any_id AS any_id FROM ").
+                append(" UNION SELECT right_any_key AS any_key FROM ").
                 append(svs.relationship().name).
                 append(" WHERE type=?").append(setParameter(parameters, cond.getRelationshipTypeKey())).
                 append(')');
@@ -525,18 +528,18 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
     private String getQuery(final RelationshipCond cond, final boolean not, final List<Object> parameters,
             final SearchSupport svs) {
 
-        StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM ").
+        StringBuilder query = new StringBuilder("SELECT DISTINCT any_key FROM ").
                 append(svs.field().name).append(" WHERE ");
 
         if (not) {
-            query.append("any_id NOT IN (");
+            query.append("any_key NOT IN (");
         } else {
-            query.append("any_id IN (");
+            query.append("any_key IN (");
         }
 
-        query.append("SELECT DISTINCT any_id ").append("FROM ").
+        query.append("SELECT DISTINCT any_key ").append("FROM ").
                 append(svs.relationship().name).append(" WHERE ").
-                append("right_any_id=?").append(setParameter(parameters, cond.getAnyObjectKey())).
+                append("right_any_key=?").append(setParameter(parameters, cond.getAnyObjectKey())).
                 append(')');
 
         return query.toString();
@@ -545,29 +548,29 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
     private String getQuery(final MembershipCond cond, final boolean not, final List<Object> parameters,
             final SearchSupport svs) {
 
-        StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM ").
+        StringBuilder query = new StringBuilder("SELECT DISTINCT any_key FROM ").
                 append(svs.field().name).append(" WHERE ");
 
         if (not) {
-            query.append("any_id NOT IN (");
+            query.append("any_key NOT IN (");
         } else {
-            query.append("any_id IN (");
+            query.append("any_key IN (");
         }
 
-        query.append("SELECT DISTINCT any_id ").append("FROM ").
+        query.append("SELECT DISTINCT any_key ").append("FROM ").
                 append(svs.membership().name).append(" WHERE ").
-                append("group_id=?").append(setParameter(parameters, cond.getGroupKey())).
+                append("group_key=?").append(setParameter(parameters, cond.getGroupKey())).
                 append(')');
 
         if (not) {
-            query.append("AND any_id NOT IN (");
+            query.append("AND any_key NOT IN (");
         } else {
-            query.append("OR any_id IN (");
+            query.append("OR any_key IN (");
         }
 
-        query.append("SELECT DISTINCT any_id ").append("FROM ").
+        query.append("SELECT DISTINCT any_key ").append("FROM ").
                 append(svs.dyngroupmembership().name).append(" WHERE ").
-                append("group_id=?").append(setParameter(parameters, cond.getGroupKey())).
+                append("group_key=?").append(setParameter(parameters, cond.getGroupKey())).
                 append(')');
 
         return query.toString();
@@ -576,29 +579,29 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
     private String getQuery(final RoleCond cond, final boolean not, final List<Object> parameters,
             final SearchSupport svs) {
 
-        StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM ").
+        StringBuilder query = new StringBuilder("SELECT DISTINCT any_key FROM ").
                 append(svs.field().name).append(" WHERE ");
 
         if (not) {
-            query.append("any_id NOT IN (");
+            query.append("any_key NOT IN (");
         } else {
-            query.append("any_id IN (");
+            query.append("any_key IN (");
         }
 
-        query.append("SELECT DISTINCT any_id ").append("FROM ").
+        query.append("SELECT DISTINCT any_key ").append("FROM ").
                 append(svs.role().name).append(" WHERE ").
-                append("role_name=?").append(setParameter(parameters, cond.getRoleKey())).
+                append("role_key=?").append(setParameter(parameters, cond.getRoleKey())).
                 append(')');
 
         if (not) {
-            query.append("AND any_id NOT IN (");
+            query.append("AND any_key NOT IN (");
         } else {
-            query.append("OR any_id IN (");
+            query.append("OR any_key IN (");
         }
 
-        query.append("SELECT DISTINCT any_id ").append("FROM ").
+        query.append("SELECT DISTINCT any_key ").append("FROM ").
                 append(svs.dynrolemembership().name).append(" WHERE ").
-                append("role_name=?").append(setParameter(parameters, cond.getRoleKey())).
+                append("role_key=?").append(setParameter(parameters, cond.getRoleKey())).
                 append(')');
 
         return query.toString();
@@ -607,25 +610,25 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
     private String getQuery(final ResourceCond cond, final boolean not, final List<Object> parameters,
             final SearchSupport svs) {
 
-        StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM ").
+        StringBuilder query = new StringBuilder("SELECT DISTINCT any_key FROM ").
                 append(svs.field().name).append(" WHERE ");
 
         if (not) {
-            query.append("any_id NOT IN (");
+            query.append("any_key NOT IN (");
         } else {
-            query.append("any_id IN (");
+            query.append("any_key IN (");
         }
 
-        query.append("SELECT DISTINCT any_id FROM ").
+        query.append("SELECT DISTINCT any_key FROM ").
                 append(svs.resource().name).
-                append(" WHERE resource_name=?").
-                append(setParameter(parameters, cond.getResourceName()));
+                append(" WHERE resource_key=?").
+                append(setParameter(parameters, cond.getResourceKey()));
 
         if (svs.anyTypeKind() == AnyTypeKind.USER) {
-            query.append(" UNION SELECT DISTINCT any_id FROM ").
+            query.append(" UNION SELECT DISTINCT any_key FROM ").
                     append(svs.groupResource().name).
-                    append(" WHERE resource_name=?").
-                    append(setParameter(parameters, cond.getResourceName()));
+                    append(" WHERE resource_key=?").
+                    append(setParameter(parameters, cond.getResourceKey()));
         }
 
         query.append(')');
@@ -634,21 +637,21 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
     }
 
     private String getQuery(final AssignableCond cond, final List<Object> parameters, final SearchSupport svs) {
-        Realm realm = realmDAO.find(cond.getRealmFullPath());
+        Realm realm = realmDAO.findByFullPath(cond.getRealmFullPath());
         if (realm == null) {
             return EMPTY_QUERY;
         }
 
-        StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM ").
+        StringBuilder query = new StringBuilder("SELECT DISTINCT any_key FROM ").
                 append(svs.field().name).append(" WHERE (");
         if (cond.isFromGroup()) {
             for (Realm current = realm; current.getParent() != null; current = current.getParent()) {
-                query.append("realm_id=?").append(setParameter(parameters, current.getKey())).append(" OR ");
+                query.append("realm_key=?").append(setParameter(parameters, current.getKey())).append(" OR ");
             }
-            query.append("realm_id=?").append(setParameter(parameters, realmDAO.getRoot().getKey()));
+            query.append("realm_key=?").append(setParameter(parameters, realmDAO.getRoot().getKey()));
         } else {
             for (Realm current : realmDAO.findDescendants(realm)) {
-                query.append("realm_id=?").append(setParameter(parameters, current.getKey())).append(" OR ");
+                query.append("realm_key=?").append(setParameter(parameters, current.getKey())).append(" OR ");
             }
             query.setLength(query.length() - 4);
         }
@@ -772,18 +775,18 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
             return EMPTY_QUERY;
         }
 
-        StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM ");
+        StringBuilder query = new StringBuilder("SELECT DISTINCT any_key FROM ");
         switch (cond.getType()) {
             case ISNOTNULL:
                 query.append(svs.field().name).
-                        append(" WHERE any_id NOT IN (SELECT any_id FROM ").
+                        append(" WHERE any_key NOT IN (SELECT any_key FROM ").
                         append(svs.nullAttr().name).
-                        append(" WHERE schema_name='").append(schema.getKey()).append("')");
+                        append(" WHERE schema_key='").append(schema.getKey()).append("')");
                 break;
 
             case ISNULL:
                 query.append(svs.nullAttr().name).
-                        append(" WHERE schema_name='").append(schema.getKey()).append("'");
+                        append(" WHERE schema_key='").append(schema.getKey()).append("'");
                 break;
 
             default:
@@ -792,7 +795,7 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
                 } else {
                     query.append(svs.attr().name);
                 }
-                query.append(" WHERE schema_name='").append(schema.getKey());
+                query.append(" WHERE schema_key='").append(schema.getKey());
                 fillAttributeQuery(query, attrValue, schema, cond, not, parameters, svs);
         }
 
@@ -805,11 +808,6 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
 
         AnyUtils attrUtils = anyUtilsFactory.getInstance(svs.anyTypeKind());
 
-        // Keeps track of difference between entity's getKey() and JPA @Id fields
-        if ("key".equals(cond.getSchema())) {
-            cond.setSchema("id");
-        }
-
         Field anyField = ReflectionUtils.findField(attrUtils.anyClass(), cond.getSchema());
         if (anyField == null) {
             LOG.warn("Ignoring invalid schema '{}'", cond.getSchema());
@@ -851,11 +849,11 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
 
             if (relMethod != null) {
                 if (Long.class.isAssignableFrom(relMethod.getReturnType())) {
-                    cond.setSchema(cond.getSchema() + "_id");
+                    cond.setSchema(cond.getSchema() + "_key");
                     schema.setType(AttrSchemaType.Long);
                 }
                 if (String.class.isAssignableFrom(relMethod.getReturnType())) {
-                    cond.setSchema(cond.getSchema() + "_name");
+                    cond.setSchema(cond.getSchema() + "_key");
                     schema.setType(AttrSchemaType.String);
                 }
             }
@@ -874,7 +872,7 @@ public class JPAAnySearchDAO extends AbstractDAO<Any<?>, Long> implements AnySea
             }
         }
 
-        final StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM ").
+        final StringBuilder query = new StringBuilder("SELECT DISTINCT any_key FROM ").
                 append(svs.field().name).append(" WHERE ");
 
         fillAttributeQuery(query, attrValue, schema, cond, not, parameters, svs);

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnyTypeClassDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnyTypeClassDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnyTypeClassDAO.java
index ee301f5..695dfa7 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnyTypeClassDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnyTypeClassDAO.java
@@ -40,7 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Repository;
 
 @Repository
-public class JPAAnyTypeClassDAO extends AbstractDAO<AnyTypeClass, String> implements AnyTypeClassDAO {
+public class JPAAnyTypeClassDAO extends AbstractDAO<AnyTypeClass> implements AnyTypeClassDAO {
 
     @Autowired
     private AnyTypeDAO anyTypeDAO;

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnyTypeDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnyTypeDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnyTypeDAO.java
index a980209..477b655 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnyTypeDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnyTypeDAO.java
@@ -29,7 +29,7 @@ import org.springframework.stereotype.Repository;
 import org.springframework.transaction.annotation.Transactional;
 
 @Repository
-public class JPAAnyTypeDAO extends AbstractDAO<AnyType, String> implements AnyTypeDAO {
+public class JPAAnyTypeDAO extends AbstractDAO<AnyType> implements AnyTypeDAO {
 
     @Transactional(readOnly = true)
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConfDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConfDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConfDAO.java
index 95db1bf..07e18e2 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConfDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConfDAO.java
@@ -33,7 +33,9 @@ import org.springframework.stereotype.Repository;
 import org.springframework.transaction.annotation.Transactional;
 
 @Repository
-public class JPAConfDAO extends AbstractDAO<Conf, Long> implements ConfDAO {
+public class JPAConfDAO extends AbstractDAO<Conf> implements ConfDAO {
+
+    private static final String KEY = "cd64d66f-6fff-4008-b966-a06b1cc1436d";
 
     @Autowired
     private PlainSchemaDAO schemaDAO;
@@ -43,10 +45,10 @@ public class JPAConfDAO extends AbstractDAO<Conf, Long> implements ConfDAO {
 
     @Override
     public Conf get() {
-        Conf instance = entityManager().find(JPAConf.class, 1L);
+        Conf instance = entityManager().find(JPAConf.class, KEY);
         if (instance == null) {
             instance = new JPAConf();
-            instance.setKey(1L);
+            instance.setKey(KEY);
 
             instance = entityManager().merge(instance);
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConnInstanceDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConnInstanceDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConnInstanceDAO.java
index de2be18..91cf1dd 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConnInstanceDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAConnInstanceDAO.java
@@ -34,7 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Repository;
 
 @Repository
-public class JPAConnInstanceDAO extends AbstractDAO<ConnInstance, Long> implements ConnInstanceDAO {
+public class JPAConnInstanceDAO extends AbstractDAO<ConnInstance> implements ConnInstanceDAO {
 
     @Autowired
     private ExternalResourceDAO resourceDAO;
@@ -43,7 +43,7 @@ public class JPAConnInstanceDAO extends AbstractDAO<ConnInstance, Long> implemen
     private ConnectorRegistry connRegistry;
 
     @Override
-    public ConnInstance find(final Long key) {
+    public ConnInstance find(final String key) {
         return entityManager().find(JPAConnInstance.class, key);
     }
 
@@ -70,7 +70,7 @@ public class JPAConnInstanceDAO extends AbstractDAO<ConnInstance, Long> implemen
     }
 
     @Override
-    public void delete(final Long key) {
+    public void delete(final String key) {
         ConnInstance connInstance = find(key);
         if (connInstance == null) {
             return;

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
index a0e5479..f8add11 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADerSchemaDAO.java
@@ -33,7 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Repository;
 
 @Repository
-public class JPADerSchemaDAO extends AbstractDAO<DerSchema, String> implements DerSchemaDAO {
+public class JPADerSchemaDAO extends AbstractDAO<DerSchema> implements DerSchemaDAO {
 
     @Autowired
     private ExternalResourceDAO resourceDAO;
@@ -49,7 +49,7 @@ public class JPADerSchemaDAO extends AbstractDAO<DerSchema, String> implements D
                 append(JPADerSchema.class.getSimpleName()).
                 append(" e WHERE ");
         for (AnyTypeClass anyTypeClass : anyTypeClasses) {
-            queryString.append("e.anyTypeClass.name='").append(anyTypeClass.getKey()).append("' OR ");
+            queryString.append("e.anyTypeClass.key='").append(anyTypeClass.getKey()).append("' OR ");
         }
 
         TypedQuery<DerSchema> query = entityManager().createQuery(

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADomainDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADomainDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADomainDAO.java
index eeee97c..ec026ff 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADomainDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADomainDAO.java
@@ -27,7 +27,7 @@ import org.springframework.stereotype.Repository;
 import org.springframework.transaction.annotation.Transactional;
 
 @Repository
-public class JPADomainDAO extends AbstractDAO<Domain, String> implements DomainDAO {
+public class JPADomainDAO extends AbstractDAO<Domain> implements DomainDAO {
 
     @Transactional(readOnly = true)
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
index 1f08938..1c56720 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
@@ -55,7 +55,7 @@ import org.springframework.stereotype.Repository;
 import org.springframework.transaction.annotation.Transactional;
 
 @Repository
-public class JPAExternalResourceDAO extends AbstractDAO<ExternalResource, String> implements ExternalResourceDAO {
+public class JPAExternalResourceDAO extends AbstractDAO<ExternalResource> implements ExternalResourceDAO {
 
     @Autowired
     private TaskDAO taskDAO;
@@ -91,7 +91,7 @@ public class JPAExternalResourceDAO extends AbstractDAO<ExternalResource, String
     }
 
     @Override
-    public Provision findProvision(final Long key) {
+    public Provision findProvision(final String key) {
         return entityManager().find(JPAProvision.class, key);
     }
 
@@ -176,11 +176,11 @@ public class JPAExternalResourceDAO extends AbstractDAO<ExternalResource, String
         query.setParameter("intAttrName", intAttrName);
         query.setParameter("intMappingType", intMappingType);
 
-        Set<Long> itemKeys = new HashSet<>();
+        Set<String> itemKeys = new HashSet<>();
         for (MappingItem item : query.getResultList()) {
             itemKeys.add(item.getKey());
         }
-        for (Long itemKey : itemKeys) {
+        for (String itemKey : itemKeys) {
             MappingItem item = entityManager().find(JPAMappingItem.class, itemKey);
             if (item != null) {
                 item.getMapping().getItems().remove(item);

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
index 990962a..3ec6d5a 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
@@ -43,6 +43,7 @@ import org.apache.syncope.core.persistence.api.search.SearchCondConverter;
 import org.apache.syncope.core.spring.security.AuthContextUtils;
 import org.apache.syncope.core.spring.security.DelegatedAdministrationException;
 import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
+import org.apache.syncope.core.persistence.api.dao.NotFoundException;
 import org.apache.syncope.core.persistence.api.dao.search.AssignableCond;
 import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
 import org.apache.syncope.core.persistence.api.entity.Any;
@@ -115,7 +116,7 @@ public class JPAGroupDAO extends AbstractAnyDAO<Group> implements GroupDAO {
     }
 
     @Override
-    public Group find(final String name) {
+    public Group findByName(final String name) {
         TypedQuery<Group> query = entityManager().createQuery(
                 "SELECT e FROM " + JPAGroup.class.getSimpleName() + " e WHERE e.name = :name", Group.class);
         query.setParameter("name", name);
@@ -130,9 +131,25 @@ public class JPAGroupDAO extends AbstractAnyDAO<Group> implements GroupDAO {
         return result;
     }
 
+    @Override
+    public Group authFindByName(final String name) {
+        if (name == null) {
+            throw new NotFoundException("Null name");
+        }
+
+        Group group = findByName(name);
+        if (group == null) {
+            throw new NotFoundException("Group " + name);
+        }
+
+        securityChecks(group);
+
+        return group;
+    }
+
     @Transactional(readOnly = true)
     @Override
-    public List<Group> findOwnedByUser(final Long userKey) {
+    public List<Group> findOwnedByUser(final String userKey) {
         User owner = userDAO.find(userKey);
         if (owner == null) {
             return Collections.<Group>emptyList();
@@ -140,8 +157,8 @@ public class JPAGroupDAO extends AbstractAnyDAO<Group> implements GroupDAO {
 
         StringBuilder queryString = new StringBuilder("SELECT e FROM ").append(JPAGroup.class.getSimpleName()).
                 append(" e WHERE e.userOwner=:owner ");
-        for (Long groupKey : userDAO.findAllGroupKeys(owner)) {
-            queryString.append("OR e.groupOwner.id=").append(groupKey).append(' ');
+        for (String groupKey : userDAO.findAllGroupKeys(owner)) {
+            queryString.append("OR e.groupOwner.key='").append(groupKey).append("' ");
         }
 
         TypedQuery<Group> query = entityManager().createQuery(queryString.toString(), Group.class);
@@ -152,8 +169,8 @@ public class JPAGroupDAO extends AbstractAnyDAO<Group> implements GroupDAO {
 
     @Transactional(readOnly = true)
     @Override
-    public List<Group> findOwnedByGroup(final Long groupId) {
-        Group owner = find(groupId);
+    public List<Group> findOwnedByGroup(final String groupKey) {
+        Group owner = find(groupKey);
         if (owner == null) {
             return Collections.<Group>emptyList();
         }
@@ -241,7 +258,7 @@ public class JPAGroupDAO extends AbstractAnyDAO<Group> implements GroupDAO {
     }
 
     private void populateTransitiveResources(
-            final Group group, final Any<?> any, final Map<Long, PropagationByResource> result) {
+            final Group group, final Any<?> any, final Map<String, PropagationByResource> result) {
 
         PropagationByResource propByRes = new PropagationByResource();
         for (ExternalResource resource : group.getResources()) {
@@ -257,10 +274,10 @@ public class JPAGroupDAO extends AbstractAnyDAO<Group> implements GroupDAO {
 
     @Transactional(readOnly = true)
     @Override
-    public Map<Long, PropagationByResource> findAnyObjectsWithTransitiveResources(final Long groupKey) {
+    public Map<String, PropagationByResource> findAnyObjectsWithTransitiveResources(final String groupKey) {
         Group group = authFind(groupKey);
 
-        Map<Long, PropagationByResource> result = new HashMap<>();
+        Map<String, PropagationByResource> result = new HashMap<>();
 
         for (AMembership membership : findAMemberships(group)) {
             populateTransitiveResources(group, membership.getLeftEnd(), result);
@@ -271,10 +288,10 @@ public class JPAGroupDAO extends AbstractAnyDAO<Group> implements GroupDAO {
 
     @Transactional(readOnly = true)
     @Override
-    public Map<Long, PropagationByResource> findUsersWithTransitiveResources(final Long groupKey) {
+    public Map<String, PropagationByResource> findUsersWithTransitiveResources(final String groupKey) {
         Group group = authFind(groupKey);
 
-        Map<Long, PropagationByResource> result = new HashMap<>();
+        Map<String, PropagationByResource> result = new HashMap<>();
 
         for (UMembership membership : findUMemberships(group)) {
             populateTransitiveResources(group, membership.getLeftEnd(), result);

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPALoggerDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPALoggerDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPALoggerDAO.java
index 9189e2a..6e4f414 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPALoggerDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPALoggerDAO.java
@@ -28,7 +28,7 @@ import org.apache.syncope.core.persistence.jpa.entity.JPALogger;
 import org.springframework.stereotype.Repository;
 
 @Repository
-public class JPALoggerDAO extends AbstractDAO<Logger, String> implements LoggerDAO {
+public class JPALoggerDAO extends AbstractDAO<Logger> implements LoggerDAO {
 
     @Override
     public Logger find(final String key) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAMailTemplateDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAMailTemplateDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAMailTemplateDAO.java
index 8b31fcf..428e4e8 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAMailTemplateDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAMailTemplateDAO.java
@@ -26,7 +26,7 @@ import org.apache.syncope.core.persistence.jpa.entity.JPAMailTemplate;
 import org.springframework.stereotype.Repository;
 
 @Repository
-public class JPAMailTemplateDAO extends AbstractDAO<MailTemplate, String> implements MailTemplateDAO {
+public class JPAMailTemplateDAO extends AbstractDAO<MailTemplate> implements MailTemplateDAO {
 
     @Override
     public MailTemplate find(final String key) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPANotificationDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPANotificationDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPANotificationDAO.java
index fa4567e..f9cf72e 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPANotificationDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPANotificationDAO.java
@@ -36,14 +36,14 @@ import org.springframework.stereotype.Repository;
 import org.springframework.transaction.annotation.Transactional;
 
 @Repository
-public class JPANotificationDAO extends AbstractDAO<Notification, Long> implements NotificationDAO {
+public class JPANotificationDAO extends AbstractDAO<Notification> implements NotificationDAO {
 
     @Autowired
     private TaskDAO taskDAO;
 
     @Transactional(readOnly = true)
     @Override
-    public Notification find(final Long key) {
+    public Notification find(final String key) {
         return entityManager().find(JPANotification.class, key);
     }
 
@@ -71,7 +71,7 @@ public class JPANotificationDAO extends AbstractDAO<Notification, Long> implemen
     }
 
     @Override
-    public void delete(final Long key) {
+    public void delete(final String key) {
         Notification notification = find(key);
         if (notification == null) {
             return;

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrDAO.java
index 0d17176..3e8a38c 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrDAO.java
@@ -33,7 +33,7 @@ import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttr;
 import org.springframework.stereotype.Repository;
 
 @Repository
-public class JPAPlainAttrDAO extends AbstractDAO<PlainAttr<?>, Long> implements PlainAttrDAO {
+public class JPAPlainAttrDAO extends AbstractDAO<PlainAttr<?>> implements PlainAttrDAO {
 
     public <T extends PlainAttr<?>> Class<? extends AbstractPlainAttr<?>> getEntityReference(
             final Class<T> reference) {
@@ -50,12 +50,12 @@ public class JPAPlainAttrDAO extends AbstractDAO<PlainAttr<?>, Long> implements
     }
 
     @Override
-    public <T extends PlainAttr<?>> T find(final Long key, final Class<T> reference) {
+    public <T extends PlainAttr<?>> T find(final String key, final Class<T> reference) {
         return reference.cast(entityManager().find(getEntityReference(reference), key));
     }
 
     @Override
-    public <T extends PlainAttr<?>> void delete(final Long key, final Class<T> reference) {
+    public <T extends PlainAttr<?>> void delete(final String key, final Class<T> reference) {
         T attribute = find(key, reference);
         if (attribute == null) {
             return;

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrValueDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrValueDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrValueDAO.java
index 62a25de..8e10858 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrValueDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainAttrValueDAO.java
@@ -43,7 +43,7 @@ import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrValue;
 import org.springframework.stereotype.Repository;
 
 @Repository
-public class JPAPlainAttrValueDAO extends AbstractDAO<PlainAttrValue, Long> implements PlainAttrValueDAO {
+public class JPAPlainAttrValueDAO extends AbstractDAO<PlainAttrValue> implements PlainAttrValueDAO {
 
     @SuppressWarnings("unchecked")
     private <T extends PlainAttrValue> Class<? extends AbstractPlainAttrValue> getEntityReference(
@@ -71,7 +71,7 @@ public class JPAPlainAttrValueDAO extends AbstractDAO<PlainAttrValue, Long> impl
     }
 
     @Override
-    public <T extends PlainAttrValue> T find(final Long key, final Class<T> reference) {
+    public <T extends PlainAttrValue> T find(final String key, final Class<T> reference) {
         return reference.cast(entityManager().find(getEntityReference(reference), key));
     }
 
@@ -88,8 +88,8 @@ public class JPAPlainAttrValueDAO extends AbstractDAO<PlainAttrValue, Long> impl
     }
 
     @Override
-    public <T extends PlainAttrValue> void delete(final Long id, final Class<T> reference) {
-        T attributeValue = find(id, reference);
+    public <T extends PlainAttrValue> void delete(final String key, final Class<T> reference) {
+        T attributeValue = find(key, reference);
         if (attributeValue == null) {
             return;
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
index 8e9edcc..5b79d53 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPlainSchemaDAO.java
@@ -36,7 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Repository;
 
 @Repository
-public class JPAPlainSchemaDAO extends AbstractDAO<PlainSchema, String> implements PlainSchemaDAO {
+public class JPAPlainSchemaDAO extends AbstractDAO<PlainSchema> implements PlainSchemaDAO {
 
     @Autowired
     private PlainAttrDAO plainAttrDAO;
@@ -55,7 +55,7 @@ public class JPAPlainSchemaDAO extends AbstractDAO<PlainSchema, String> implemen
                 append(JPAPlainSchema.class.getSimpleName()).
                 append(" e WHERE ");
         for (AnyTypeClass anyTypeClass : anyTypeClasses) {
-            queryString.append("e.anyTypeClass.name='").append(anyTypeClass.getKey()).append("' OR ");
+            queryString.append("e.anyTypeClass.key='").append(anyTypeClass.getKey()).append("' OR ");
         }
 
         TypedQuery<PlainSchema> query = entityManager().createQuery(

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
index db216be..4c76f44 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
@@ -38,7 +38,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Repository;
 
 @Repository
-public class JPAPolicyDAO extends AbstractDAO<Policy, Long> implements PolicyDAO {
+public class JPAPolicyDAO extends AbstractDAO<Policy> implements PolicyDAO {
 
     @Autowired
     private RealmDAO realmDAO;
@@ -57,7 +57,7 @@ public class JPAPolicyDAO extends AbstractDAO<Policy, Long> implements PolicyDAO
 
     @SuppressWarnings("unchecked")
     @Override
-    public <T extends Policy> T find(final Long key) {
+    public <T extends Policy> T find(final String key) {
         return (T) entityManager().find(AbstractPolicy.class, key);
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
index d0a4782..b2cd657 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
@@ -42,7 +42,7 @@ import org.springframework.stereotype.Repository;
 import org.springframework.transaction.annotation.Transactional;
 
 @Repository
-public class JPARealmDAO extends AbstractDAO<Realm, Long> implements RealmDAO {
+public class JPARealmDAO extends AbstractDAO<Realm> implements RealmDAO {
 
     @Autowired
     private RoleDAO roleDAO;
@@ -63,13 +63,13 @@ public class JPARealmDAO extends AbstractDAO<Realm, Long> implements RealmDAO {
     }
 
     @Override
-    public Realm find(final Long key) {
+    public Realm find(final String key) {
         return entityManager().find(JPARealm.class, key);
     }
 
     @Transactional(readOnly = true)
     @Override
-    public Realm find(final String fullPath) {
+    public Realm findByFullPath(final String fullPath) {
         if (SyncopeConstants.ROOT_REALM.equals(fullPath)) {
             return getRoot();
         }
@@ -202,7 +202,7 @@ public class JPARealmDAO extends AbstractDAO<Realm, Long> implements RealmDAO {
     }
 
     @Override
-    public void delete(final Long key) {
+    public void delete(final String key) {
         Realm realm = find(key);
         if (realm == null) {
             return;

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARelationshipTypeDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARelationshipTypeDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARelationshipTypeDAO.java
index d662cd0..4af6c98 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARelationshipTypeDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARelationshipTypeDAO.java
@@ -35,7 +35,7 @@ import org.apache.syncope.core.persistence.jpa.entity.user.JPAURelationship;
 import org.springframework.stereotype.Repository;
 
 @Repository
-public class JPARelationshipTypeDAO extends AbstractDAO<RelationshipType, String> implements RelationshipTypeDAO {
+public class JPARelationshipTypeDAO extends AbstractDAO<RelationshipType> implements RelationshipTypeDAO {
 
     @Override
     public RelationshipType find(final String key) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAReportDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAReportDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAReportDAO.java
index 5f39e20..959eac2 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAReportDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAReportDAO.java
@@ -28,11 +28,11 @@ import org.springframework.stereotype.Repository;
 import org.springframework.transaction.annotation.Transactional;
 
 @Repository
-public class JPAReportDAO extends AbstractDAO<Report, Long> implements ReportDAO {
+public class JPAReportDAO extends AbstractDAO<Report> implements ReportDAO {
 
     @Transactional(readOnly = true)
     @Override
-    public Report find(final Long key) {
+    public Report find(final String key) {
         return entityManager().find(JPAReport.class, key);
     }
 
@@ -62,7 +62,7 @@ public class JPAReportDAO extends AbstractDAO<Report, Long> implements ReportDAO
     }
 
     @Override
-    public void delete(final Long key) {
+    public void delete(final String key) {
         Report report = find(key);
         if (report == null) {
             return;

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAReportExecDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAReportExecDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAReportExecDAO.java
index 1e0af21..d5b801e 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAReportExecDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAReportExecDAO.java
@@ -29,10 +29,10 @@ import org.springframework.stereotype.Repository;
 import org.springframework.transaction.annotation.Transactional;
 
 @Repository
-public class JPAReportExecDAO extends AbstractDAO<ReportExec, Long> implements ReportExecDAO {
+public class JPAReportExecDAO extends AbstractDAO<ReportExec> implements ReportExecDAO {
 
     @Override
-    public ReportExec find(final Long key) {
+    public ReportExec find(final String key) {
         return entityManager().find(JPAReportExec.class, key);
     }
 
@@ -115,7 +115,7 @@ public class JPAReportExecDAO extends AbstractDAO<ReportExec, Long> implements R
     }
 
     @Override
-    public void delete(final Long key) {
+    public void delete(final String key) {
         ReportExec execution = find(key);
         if (execution == null) {
             return;


Mime
View raw message