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

[12/24] syncope git commit: [SYNCOPE-822] UUID keys

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/EntityValidationListener.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/EntityValidationListener.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/EntityValidationListener.java
index 9d86b88..387e368 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/EntityValidationListener.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/EntityValidationListener.java
@@ -30,6 +30,7 @@ import org.apache.syncope.core.persistence.api.entity.AnnotatedEntity;
 import org.apache.syncope.core.persistence.api.entity.Any;
 import org.apache.syncope.core.persistence.api.entity.Entity;
 import org.apache.syncope.core.persistence.api.entity.Policy;
+import org.apache.syncope.core.persistence.api.entity.ProvidedKeyEntity;
 import org.apache.syncope.core.persistence.api.entity.Schema;
 import org.apache.syncope.core.persistence.api.entity.task.Task;
 import org.slf4j.Logger;
@@ -57,6 +58,7 @@ public class EntityValidationListener {
             for (Class<?> interf : ClassUtils.getAllInterfaces(object.getClass())) {
                 if (!Entity.class.equals(interf)
                         && !AnnotatedEntity.class.equals(interf)
+                        && !ProvidedKeyEntity.class.equals(interf)
                         && !Schema.class.equals(interf)
                         && !Task.class.equals(interf)
                         && !Policy.class.equals(interf)

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

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaKeyValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaKeyValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaKeyValidator.java
new file mode 100644
index 0000000..b4d00d5
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaKeyValidator.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.validation.entity;
+
+import java.lang.reflect.Field;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.validation.ConstraintValidatorContext;
+import org.apache.commons.lang3.ClassUtils;
+import org.apache.syncope.common.lib.types.EntityViolationType;
+import org.apache.syncope.core.persistence.api.entity.DerSchema;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+import org.apache.syncope.core.persistence.api.entity.VirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAnyObject;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPAConf;
+import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
+
+public class SchemaKeyValidator extends AbstractValidator<SchemaKeyCheck, Object> {
+
+    private static final Set<String> UNALLOWED_SCHEMA_KEYS = new HashSet<>();
+
+    static {
+        initUnallowedSchemaKeys(JPAAnyObject.class, UNALLOWED_SCHEMA_KEYS);
+        initUnallowedSchemaKeys(JPAGroup.class, UNALLOWED_SCHEMA_KEYS);
+        initUnallowedSchemaKeys(JPAUser.class, UNALLOWED_SCHEMA_KEYS);
+        initUnallowedSchemaKeys(JPAConf.class, UNALLOWED_SCHEMA_KEYS);
+    }
+
+    private static void initUnallowedSchemaKeys(final Class<?> entityClass, final Set<String> keys) {
+        List<Class<?>> classes = ClassUtils.getAllSuperclasses(entityClass);
+        if (!classes.contains(JPAUser.class)) {
+            classes.add(JPAUser.class);
+        }
+        for (Class<?> clazz : classes) {
+            for (Field field : clazz.getDeclaredFields()) {
+                if (!Collection.class.isAssignableFrom(field.getType())
+                        && !Map.class.isAssignableFrom(field.getType())) {
+
+                    keys.add(field.getName());
+                }
+            }
+        }
+    }
+
+    @Override
+    public boolean isValid(final Object object, final ConstraintValidatorContext context) {
+        String schemaName;
+        Set<String> unallowedNames = UNALLOWED_SCHEMA_KEYS;
+        if (object instanceof PlainSchema) {
+            schemaName = ((PlainSchema) object).getKey();
+        } else if (object instanceof DerSchema) {
+            schemaName = ((DerSchema) object).getKey();
+        } else if (object instanceof VirSchema) {
+            schemaName = ((VirSchema) object).getKey();
+        } else {
+            schemaName = null;
+            unallowedNames = Collections.emptySet();
+        }
+
+        boolean isValid = NAME_PATTERN.matcher(schemaName).matches();
+        if (!isValid) {
+            context.disableDefaultConstraintViolation();
+            context.buildConstraintViolationWithTemplate(
+                    getTemplate(EntityViolationType.InvalidName, "Invalid Schema name")).
+                    addPropertyNode("name").addConstraintViolation();
+        } else if (unallowedNames.contains(schemaName)) {
+            context.disableDefaultConstraintViolation();
+            context.buildConstraintViolationWithTemplate(
+                    getTemplate(EntityViolationType.InvalidName, "Schema name not allowed: " + schemaName)).
+                    addPropertyNode("name").addConstraintViolation();
+
+            return false;
+        }
+
+        return isValid;
+    }
+}

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

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java
deleted file mode 100644
index a9b622e..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.persistence.jpa.validation.entity;
-
-import java.lang.reflect.Field;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.validation.ConstraintValidatorContext;
-import org.apache.commons.lang3.ClassUtils;
-import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
-import org.apache.syncope.core.persistence.api.entity.VirSchema;
-import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAnyObject;
-import org.apache.syncope.core.persistence.jpa.entity.conf.JPAConf;
-import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
-
-public class SchemaNameValidator extends AbstractValidator<SchemaNameCheck, Object> {
-
-    private static final Set<String> UNALLOWED_SCHEMA_NAMES = new HashSet<>();
-
-    static {
-        initUnallowedSchemaNames(JPAAnyObject.class, UNALLOWED_SCHEMA_NAMES);
-        initUnallowedSchemaNames(JPAGroup.class, UNALLOWED_SCHEMA_NAMES);
-        initUnallowedSchemaNames(JPAUser.class, UNALLOWED_SCHEMA_NAMES);
-        initUnallowedSchemaNames(JPAConf.class, UNALLOWED_SCHEMA_NAMES);
-    }
-
-    private static void initUnallowedSchemaNames(final Class<?> entityClass, final Set<String> names) {
-        List<Class<?>> classes = ClassUtils.getAllSuperclasses(entityClass);
-        if (!classes.contains(JPAUser.class)) {
-            classes.add(JPAUser.class);
-        }
-        for (Class<?> clazz : classes) {
-            for (Field field : clazz.getDeclaredFields()) {
-                if (!Collection.class.isAssignableFrom(field.getType())
-                        && !Map.class.isAssignableFrom(field.getType())) {
-
-                    names.add(field.getName());
-                }
-            }
-        }
-    }
-
-    @Override
-    public boolean isValid(final Object object, final ConstraintValidatorContext context) {
-        String schemaName;
-        Set<String> unallowedNames = UNALLOWED_SCHEMA_NAMES;
-        if (object instanceof PlainSchema) {
-            schemaName = ((PlainSchema) object).getKey();
-        } else if (object instanceof DerSchema) {
-            schemaName = ((DerSchema) object).getKey();
-        } else if (object instanceof VirSchema) {
-            schemaName = ((VirSchema) object).getKey();
-        } else {
-            schemaName = null;
-            unallowedNames = Collections.emptySet();
-        }
-
-        boolean isValid = NAME_PATTERN.matcher(schemaName).matches();
-        if (!isValid) {
-            context.disableDefaultConstraintViolation();
-            context.buildConstraintViolationWithTemplate(
-                    getTemplate(EntityViolationType.InvalidName, "Invalid Schema name")).
-                    addPropertyNode("name").addConstraintViolation();
-        } else if (unallowedNames.contains(schemaName)) {
-            context.disableDefaultConstraintViolation();
-            context.buildConstraintViolationWithTemplate(
-                    getTemplate(EntityViolationType.InvalidName, "Schema name not allowed: " + schemaName)).
-                    addPropertyNode("name").addConstraintViolation();
-
-            return false;
-        }
-
-        return isValid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
index 42cb116..78a8098 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml
@@ -34,193 +34,8 @@ under the License.
     </persistence-unit-defaults>
   </persistence-unit-metadata>
   
-  <table-generator name="SEQ_UPlainAttrValue" pk-column-value="SEQ_UPlainAttrValue" initial-value="100"/>
-  <table-generator name="SEQ_GPlainAttrValue" pk-column-value="SEQ_GPlainAttrValue" initial-value="100"/>
-  <table-generator name="SEQ_APlainAttrValue" pk-column-value="SEQ_APlainAttrValue" initial-value="100"/>
-  <table-generator name="SEQ_CPlainAttrValue" pk-column-value="SEQ_CPlainAttrValue" initial-value="100"/>
+  <sequence-generator name="uuid" sequence-name="org.apache.syncope.core.persistence.jpa.openjpa.UUIDGenerator()"/>
 
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPARealm">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Realm" strategy="TABLE"/>
-        <table-generator name="SEQ_Realm" pk-column-value="SEQ_Realm" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAnyObject">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AnyObject" strategy="TABLE"/>
-        <table-generator name="SEQ_AnyObject" pk-column-value="SEQ_AnyObject" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAARelationship">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ARelationship" strategy="TABLE"/>
-        <table-generator name="SEQ_ARelationship" pk-column-value="SEQ_ARelationship" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAMembership">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AMembership" strategy="TABLE"/>
-        <table-generator name="SEQ_AMembership" pk-column-value="SEQ_AMembership" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPADynRoleMembership">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_DynRoleMembership" strategy="TABLE"/>
-        <table-generator name="SEQ_DynRoleMembership" pk-column-value="SEQ_DynRoleMembership" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUser">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_User" strategy="TABLE"/>
-        <table-generator name="SEQ_User" pk-column-value="SEQ_User" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAURelationship">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_URelationship" strategy="TABLE"/>
-        <table-generator name="SEQ_URelationship" pk-column-value="SEQ_URelationship" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUMembership">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UMembership" strategy="TABLE"/>
-        <table-generator name="SEQ_UMembership" pk-column-value="SEQ_UMembership" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Group" strategy="TABLE"/>
-        <table-generator name="SEQ_Group" pk-column-value="SEQ_Group" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPATypeExtension">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_TypeExtension" strategy="TABLE"/>
-        <table-generator name="SEQ_TypeExtension" pk-column-value="SEQ_TypeExtension" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAADynGroupMembership">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ADynGroupMembership" strategy="TABLE"/>
-        <table-generator name="SEQ_ADynGroupMembership" pk-column-value="SEQ_ADynGroupMembership" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUDynGroupMembership">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UDynGroupMembership" strategy="TABLE"/>
-        <table-generator name="SEQ_UDynGroupMembership" pk-column-value="SEQ_UDynGroupMembership" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.resource.JPAProvision">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Provision" strategy="TABLE"/>
-        <table-generator name="SEQ_Provision" pk-column-value="SEQ_Provision" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.resource.JPAMapping">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Mapping" strategy="TABLE"/>
-        <table-generator name="SEQ_Mapping" pk-column-value="SEQ_Mapping" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.resource.JPAMappingItem">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_MappingItem" strategy="TABLE"/>
-        <table-generator name="SEQ_MappingItem" pk-column-value="SEQ_MappingItem" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAConnInstance">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ConnInstance" strategy="TABLE"/>
-        <table-generator name="SEQ_ConnInstance" pk-column-value="SEQ_ConnInstance" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_APlainAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_APlainAttr" pk-column-value="SEQ_APlainAttr" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UPlainAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_UPlainAttr" pk-column-value="SEQ_UPlainAttr" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_GPlainAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_GPlainAttr" pk-column-value="SEQ_GPlainAttr" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_CAttrPlain" strategy="TABLE"/>
-        <table-generator name="SEQ_CAttrPlain" pk-column-value="SEQ_CAttrPlain" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttrValue">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_APlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
-  </entity>
   <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttrUniqueValue">
     <table>
       <unique-constraint>
@@ -229,22 +44,10 @@ under the License.
         <column-name>stringValue</column-name>
         <column-name>doubleValue</column-name>
         <column-name>longValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
     </table>
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_APlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
   </entity>    
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrValue">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
-  </entity>
   <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrUniqueValue">
     <table>
       <unique-constraint>
@@ -253,21 +56,9 @@ under the License.
         <column-name>stringValue</column-name>
         <column-name>doubleValue</column-name>
         <column-name>longValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
     </table>
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
   </entity>
   <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue">
     <table>
@@ -277,21 +68,9 @@ under the License.
         <column-name>stringValue</column-name>
         <column-name>doubleValue</column-name>
         <column-name>longValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
     </table>
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrValue">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_CPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
   </entity>
   <entity class="org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrUniqueValue">
     <table>
@@ -301,133 +80,8 @@ under the License.
         <column-name>stringValue</column-name>
         <column-name>doubleValue</column-name>
         <column-name>longValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
     </table>
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_CPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAAnyTemplateRealm">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AnyTemplateRealm" strategy="TABLE"/>
-        <table-generator name="SEQ_AnyTemplateRealm" pk-column-value="SEQ_AnyTemplateRealm" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.task.JPAAnyTemplatePullTask">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AnyTemplatePullTask" strategy="TABLE"/>
-        <table-generator name="SEQ_AnyTemplatePullTask" pk-column-value="SEQ_AnyTemplatePullTask" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.task.JPAPushTaskAnyFilter">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_PushTaskAnyFilter" strategy="TABLE"/>
-        <table-generator name="SEQ_PushTaskAnyFilter" pk-column-value="SEQ_PushTaskAnyFilter" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.task.AbstractTask">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Task" strategy="TABLE"/>
-        <table-generator name="SEQ_Task" pk-column-value="SEQ_Task" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.task.JPATaskExec">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_TaskExec" strategy="TABLE"/>
-        <table-generator name="SEQ_TaskExec" pk-column-value="SEQ_TaskExec" initial-value="10"/>
-      </id>
-    </attributes>
-  </entity>
-    
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.policy.AbstractPolicy">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Policy" strategy="TABLE"/>
-        <table-generator name="SEQ_Policy" pk-column-value="SEQ_Policy" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.policy.JPAAccountRuleConfInstance">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AccountRuleConfInstance" strategy="TABLE"/>
-        <table-generator name="SEQ_AccountRuleConfInstance" pk-column-value="SEQ_AccountRuleConfInstance" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.policy.JPAPasswordRuleConfInstance">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_PasswordRuleConfInstance" strategy="TABLE"/>
-        <table-generator name="SEQ_PasswordRuleConfInstance" pk-column-value="SEQ_PasswordRuleConfInstance" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAReport">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Report" strategy="TABLE"/>
-        <table-generator name="SEQ_Report" pk-column-value="SEQ_Report" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAReportExec">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ReportExec" strategy="TABLE"/>
-        <table-generator name="SEQ_ReportExec" pk-column-value="SEQ_ReportExec" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAReportletConfInstance">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ReportletConfInstance" strategy="TABLE"/>
-        <table-generator name="SEQ_ReportletConfInstance" pk-column-value="SEQ_ReportletConfInstance" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAAnyAbout">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AnyAbout" strategy="TABLE"/>
-        <table-generator name="SEQ_AnyAbout" pk-column-value="SEQ_AnyAbout" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPANotification">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Notification" strategy="TABLE"/>
-        <table-generator name="SEQ_Notification" pk-column-value="SEQ_Notification" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPASecurityQuestion">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_SecurityQuestion" strategy="TABLE"/>
-        <table-generator name="SEQ_SecurityQuestion" pk-column-value="SEQ_SecurityQuestion" initial-value="100"/>
-      </id>
-    </attributes>
   </entity>
 </entity-mappings>

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
index 42cb116..f27990a 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml
@@ -22,7 +22,7 @@ under the License.
                  xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm 
                                      http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
                  version="2.0">
-  
+
   <persistence-unit-metadata>
     <persistence-unit-defaults>
       <entity-listeners>
@@ -33,194 +33,9 @@ under the License.
       </entity-listeners>
     </persistence-unit-defaults>
   </persistence-unit-metadata>
-  
-  <table-generator name="SEQ_UPlainAttrValue" pk-column-value="SEQ_UPlainAttrValue" initial-value="100"/>
-  <table-generator name="SEQ_GPlainAttrValue" pk-column-value="SEQ_GPlainAttrValue" initial-value="100"/>
-  <table-generator name="SEQ_APlainAttrValue" pk-column-value="SEQ_APlainAttrValue" initial-value="100"/>
-  <table-generator name="SEQ_CPlainAttrValue" pk-column-value="SEQ_CPlainAttrValue" initial-value="100"/>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPARealm">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Realm" strategy="TABLE"/>
-        <table-generator name="SEQ_Realm" pk-column-value="SEQ_Realm" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAnyObject">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AnyObject" strategy="TABLE"/>
-        <table-generator name="SEQ_AnyObject" pk-column-value="SEQ_AnyObject" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAARelationship">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ARelationship" strategy="TABLE"/>
-        <table-generator name="SEQ_ARelationship" pk-column-value="SEQ_ARelationship" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAMembership">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AMembership" strategy="TABLE"/>
-        <table-generator name="SEQ_AMembership" pk-column-value="SEQ_AMembership" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPADynRoleMembership">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_DynRoleMembership" strategy="TABLE"/>
-        <table-generator name="SEQ_DynRoleMembership" pk-column-value="SEQ_DynRoleMembership" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
 
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUser">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_User" strategy="TABLE"/>
-        <table-generator name="SEQ_User" pk-column-value="SEQ_User" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAURelationship">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_URelationship" strategy="TABLE"/>
-        <table-generator name="SEQ_URelationship" pk-column-value="SEQ_URelationship" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
+  <sequence-generator name="uuid" sequence-name="org.apache.syncope.core.persistence.jpa.openjpa.UUIDGenerator()"/>
   
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUMembership">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UMembership" strategy="TABLE"/>
-        <table-generator name="SEQ_UMembership" pk-column-value="SEQ_UMembership" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Group" strategy="TABLE"/>
-        <table-generator name="SEQ_Group" pk-column-value="SEQ_Group" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPATypeExtension">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_TypeExtension" strategy="TABLE"/>
-        <table-generator name="SEQ_TypeExtension" pk-column-value="SEQ_TypeExtension" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAADynGroupMembership">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ADynGroupMembership" strategy="TABLE"/>
-        <table-generator name="SEQ_ADynGroupMembership" pk-column-value="SEQ_ADynGroupMembership" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUDynGroupMembership">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UDynGroupMembership" strategy="TABLE"/>
-        <table-generator name="SEQ_UDynGroupMembership" pk-column-value="SEQ_UDynGroupMembership" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.resource.JPAProvision">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Provision" strategy="TABLE"/>
-        <table-generator name="SEQ_Provision" pk-column-value="SEQ_Provision" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.resource.JPAMapping">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Mapping" strategy="TABLE"/>
-        <table-generator name="SEQ_Mapping" pk-column-value="SEQ_Mapping" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.resource.JPAMappingItem">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_MappingItem" strategy="TABLE"/>
-        <table-generator name="SEQ_MappingItem" pk-column-value="SEQ_MappingItem" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAConnInstance">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ConnInstance" strategy="TABLE"/>
-        <table-generator name="SEQ_ConnInstance" pk-column-value="SEQ_ConnInstance" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_APlainAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_APlainAttr" pk-column-value="SEQ_APlainAttr" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UPlainAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_UPlainAttr" pk-column-value="SEQ_UPlainAttr" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_GPlainAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_GPlainAttr" pk-column-value="SEQ_GPlainAttr" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_CAttrPlain" strategy="TABLE"/>
-        <table-generator name="SEQ_CAttrPlain" pk-column-value="SEQ_CAttrPlain" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttrValue">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_APlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
-  </entity>
   <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttrUniqueValue">
     <table>
       <unique-constraint>
@@ -229,22 +44,10 @@ under the License.
         <column-name>stringValue</column-name>
         <column-name>doubleValue</column-name>
         <column-name>longValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
     </table>
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_APlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
   </entity>    
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrValue">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
-  </entity>
   <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrUniqueValue">
     <table>
       <unique-constraint>
@@ -253,21 +56,9 @@ under the License.
         <column-name>stringValue</column-name>
         <column-name>doubleValue</column-name>
         <column-name>longValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
     </table>
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
   </entity>
   <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue">
     <table>
@@ -277,21 +68,9 @@ under the License.
         <column-name>stringValue</column-name>
         <column-name>doubleValue</column-name>
         <column-name>longValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
     </table>
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrValue">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_CPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
   </entity>
   <entity class="org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrUniqueValue">
     <table>
@@ -301,133 +80,8 @@ under the License.
         <column-name>stringValue</column-name>
         <column-name>doubleValue</column-name>
         <column-name>longValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
     </table>
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_CPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAAnyTemplateRealm">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AnyTemplateRealm" strategy="TABLE"/>
-        <table-generator name="SEQ_AnyTemplateRealm" pk-column-value="SEQ_AnyTemplateRealm" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.task.JPAAnyTemplatePullTask">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AnyTemplatePullTask" strategy="TABLE"/>
-        <table-generator name="SEQ_AnyTemplatePullTask" pk-column-value="SEQ_AnyTemplatePullTask" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.task.JPAPushTaskAnyFilter">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_PushTaskAnyFilter" strategy="TABLE"/>
-        <table-generator name="SEQ_PushTaskAnyFilter" pk-column-value="SEQ_PushTaskAnyFilter" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.task.AbstractTask">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Task" strategy="TABLE"/>
-        <table-generator name="SEQ_Task" pk-column-value="SEQ_Task" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.task.JPATaskExec">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_TaskExec" strategy="TABLE"/>
-        <table-generator name="SEQ_TaskExec" pk-column-value="SEQ_TaskExec" initial-value="10"/>
-      </id>
-    </attributes>
-  </entity>
-    
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.policy.AbstractPolicy">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Policy" strategy="TABLE"/>
-        <table-generator name="SEQ_Policy" pk-column-value="SEQ_Policy" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.policy.JPAAccountRuleConfInstance">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AccountRuleConfInstance" strategy="TABLE"/>
-        <table-generator name="SEQ_AccountRuleConfInstance" pk-column-value="SEQ_AccountRuleConfInstance" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.policy.JPAPasswordRuleConfInstance">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_PasswordRuleConfInstance" strategy="TABLE"/>
-        <table-generator name="SEQ_PasswordRuleConfInstance" pk-column-value="SEQ_PasswordRuleConfInstance" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAReport">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Report" strategy="TABLE"/>
-        <table-generator name="SEQ_Report" pk-column-value="SEQ_Report" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAReportExec">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ReportExec" strategy="TABLE"/>
-        <table-generator name="SEQ_ReportExec" pk-column-value="SEQ_ReportExec" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAReportletConfInstance">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ReportletConfInstance" strategy="TABLE"/>
-        <table-generator name="SEQ_ReportletConfInstance" pk-column-value="SEQ_ReportletConfInstance" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAAnyAbout">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AnyAbout" strategy="TABLE"/>
-        <table-generator name="SEQ_AnyAbout" pk-column-value="SEQ_AnyAbout" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPANotification">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Notification" strategy="TABLE"/>
-        <table-generator name="SEQ_Notification" pk-column-value="SEQ_Notification" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPASecurityQuestion">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_SecurityQuestion" strategy="TABLE"/>
-        <table-generator name="SEQ_SecurityQuestion" pk-column-value="SEQ_SecurityQuestion" initial-value="100"/>
-      </id>
-    </attributes>
   </entity>
 </entity-mappings>

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml b/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
index 721916c..1d67501 100644
--- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
+++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml
@@ -33,449 +33,103 @@ under the License.
       </entity-listeners>
     </persistence-unit-defaults>
   </persistence-unit-metadata>
-  
-  <table-generator name="SEQ_UPlainAttrValue" pk-column-value="SEQ_UPlainAttrValue" initial-value="100"/>
-  <table-generator name="SEQ_GPlainAttrValue" pk-column-value="SEQ_GPlainAttrValue" initial-value="100"/>
-  <table-generator name="SEQ_APlainAttrValue" pk-column-value="SEQ_APlainAttrValue" initial-value="100"/>
-  <table-generator name="SEQ_CPlainAttrValue" pk-column-value="SEQ_CPlainAttrValue" initial-value="100"/>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPARealm">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Realm" strategy="TABLE"/>
-        <table-generator name="SEQ_Realm" pk-column-value="SEQ_Realm" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAnyObject">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AnyObject" strategy="TABLE"/>
-        <table-generator name="SEQ_AnyObject" pk-column-value="SEQ_AnyObject" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAARelationship">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ARelationship" strategy="TABLE"/>
-        <table-generator name="SEQ_ARelationship" pk-column-value="SEQ_ARelationship" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAMembership">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AMembership" strategy="TABLE"/>
-        <table-generator name="SEQ_AMembership" pk-column-value="SEQ_AMembership" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPADynRoleMembership">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_DynRoleMembership" strategy="TABLE"/>
-        <table-generator name="SEQ_DynRoleMembership" pk-column-value="SEQ_DynRoleMembership" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUser">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_User" strategy="TABLE"/>
-        <table-generator name="SEQ_User" pk-column-value="SEQ_User" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAURelationship">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_URelationship" strategy="TABLE"/>
-        <table-generator name="SEQ_URelationship" pk-column-value="SEQ_URelationship" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUMembership">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UMembership" strategy="TABLE"/>
-        <table-generator name="SEQ_UMembership" pk-column-value="SEQ_UMembership" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Group" strategy="TABLE"/>
-        <table-generator name="SEQ_Group" pk-column-value="SEQ_Group" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPATypeExtension">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_TypeExtension" strategy="TABLE"/>
-        <table-generator name="SEQ_TypeExtension" pk-column-value="SEQ_TypeExtension" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
 
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAADynGroupMembership">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ADynGroupMembership" strategy="TABLE"/>
-        <table-generator name="SEQ_ADynGroupMembership" pk-column-value="SEQ_ADynGroupMembership" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
+  <sequence-generator name="uuid" sequence-name="org.apache.syncope.core.persistence.jpa.openjpa.UUIDGenerator()"/>
   
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUDynGroupMembership">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UDynGroupMembership" strategy="TABLE"/>
-        <table-generator name="SEQ_UDynGroupMembership" pk-column-value="SEQ_UDynGroupMembership" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.resource.JPAProvision">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Provision" strategy="TABLE"/>
-        <table-generator name="SEQ_Provision" pk-column-value="SEQ_Provision" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.resource.JPAMapping">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Mapping" strategy="TABLE"/>
-        <table-generator name="SEQ_Mapping" pk-column-value="SEQ_Mapping" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.resource.JPAMappingItem">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_MappingItem" strategy="TABLE"/>
-        <table-generator name="SEQ_MappingItem" pk-column-value="SEQ_MappingItem" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAConnInstance">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ConnInstance" strategy="TABLE"/>
-        <table-generator name="SEQ_ConnInstance" pk-column-value="SEQ_ConnInstance" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_APlainAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_APlainAttr" pk-column-value="SEQ_APlainAttr" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UPlainAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_UPlainAttr" pk-column-value="SEQ_UPlainAttr" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_GPlainAttr" strategy="TABLE"/>
-        <table-generator name="SEQ_GPlainAttr" pk-column-value="SEQ_GPlainAttr" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttr">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_CAttrPlain" strategy="TABLE"/>
-        <table-generator name="SEQ_CAttrPlain" pk-column-value="SEQ_CAttrPlain" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttrValue">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_APlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
-  </entity>
   <entity class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttrUniqueValue">
     <table>
       <unique-constraint>
         <column-name>booleanValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
       <unique-constraint>
         <column-name>dateValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
       <unique-constraint>
         <column-name>stringValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
       <unique-constraint>
         <column-name>doubleValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
       <unique-constraint>
         <column-name>longValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
     </table>
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_APlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
   </entity>    
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrValue">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
-  </entity>
   <entity class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrUniqueValue">
     <table>
       <unique-constraint>
         <column-name>booleanValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
       <unique-constraint>
         <column-name>dateValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
       <unique-constraint>
         <column-name>stringValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
       <unique-constraint>
         <column-name>doubleValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
       <unique-constraint>
         <column-name>longValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
     </table>
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_UPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
   </entity>
   <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue">
     <table>
       <unique-constraint>
         <column-name>booleanValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
       <unique-constraint>
         <column-name>dateValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
       <unique-constraint>
         <column-name>stringValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
       <unique-constraint>
         <column-name>doubleValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
       <unique-constraint>
         <column-name>longValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
     </table>
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrValue">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_CPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
   </entity>
   <entity class="org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrUniqueValue">
     <table>
       <unique-constraint>
         <column-name>booleanValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
       <unique-constraint>
         <column-name>dateValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
       <unique-constraint>
         <column-name>stringValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
       <unique-constraint>
         <column-name>doubleValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
       <unique-constraint>
         <column-name>longValue</column-name>
-        <column-name>schema_name</column-name>
+        <column-name>schema_key</column-name>
       </unique-constraint>
     </table>
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_CPlainAttrValue" strategy="TABLE"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAAnyTemplateRealm">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AnyTemplateRealm" strategy="TABLE"/>
-        <table-generator name="SEQ_AnyTemplateRealm" pk-column-value="SEQ_AnyTemplateRealm" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.task.JPAAnyTemplatePullTask">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AnyTemplatePullTask" strategy="TABLE"/>
-        <table-generator name="SEQ_AnyTemplatePullTask" pk-column-value="SEQ_AnyTemplatePullTask" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.task.JPAPushTaskAnyFilter">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_PushTaskAnyFilter" strategy="TABLE"/>
-        <table-generator name="SEQ_PushTaskAnyFilter" pk-column-value="SEQ_PushTaskAnyFilter" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.task.AbstractTask">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Task" strategy="TABLE"/>
-        <table-generator name="SEQ_Task" pk-column-value="SEQ_Task" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.task.JPATaskExec">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_TaskExec" strategy="TABLE"/>
-        <table-generator name="SEQ_TaskExec" pk-column-value="SEQ_TaskExec" initial-value="10"/>
-      </id>
-    </attributes>
-  </entity>
-    
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.policy.AbstractPolicy">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Policy" strategy="TABLE"/>
-        <table-generator name="SEQ_Policy" pk-column-value="SEQ_Policy" initial-value="1000"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.policy.JPAAccountRuleConfInstance">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AccountRuleConfInstance" strategy="TABLE"/>
-        <table-generator name="SEQ_AccountRuleConfInstance" pk-column-value="SEQ_AccountRuleConfInstance" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.policy.JPAPasswordRuleConfInstance">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_PasswordRuleConfInstance" strategy="TABLE"/>
-        <table-generator name="SEQ_PasswordRuleConfInstance" pk-column-value="SEQ_PasswordRuleConfInstance" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-    
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAReport">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Report" strategy="TABLE"/>
-        <table-generator name="SEQ_Report" pk-column-value="SEQ_Report" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAReportExec">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ReportExec" strategy="TABLE"/>
-        <table-generator name="SEQ_ReportExec" pk-column-value="SEQ_ReportExec" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAReportletConfInstance">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_ReportletConfInstance" strategy="TABLE"/>
-        <table-generator name="SEQ_ReportletConfInstance" pk-column-value="SEQ_ReportletConfInstance" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPAAnyAbout">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_AnyAbout" strategy="TABLE"/>
-        <table-generator name="SEQ_AnyAbout" pk-column-value="SEQ_AnyAbout" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPANotification">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_Notification" strategy="TABLE"/>
-        <table-generator name="SEQ_Notification" pk-column-value="SEQ_Notification" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
-  
-  <entity class="org.apache.syncope.core.persistence.jpa.entity.JPASecurityQuestion">
-    <attributes>
-      <id name="id">
-        <generated-value generator="SEQ_SecurityQuestion" strategy="TABLE"/>
-        <table-generator name="SEQ_SecurityQuestion" pk-column-value="SEQ_SecurityQuestion" initial-value="100"/>
-      </id>
-    </attributes>
-  </entity>
+  </entity>  
 </entity-mappings>

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/resources/domains.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/domains.xml b/core/persistence-jpa/src/main/resources/domains.xml
index 42f87d0..d58f2cb 100644
--- a/core/persistence-jpa/src/main/resources/domains.xml
+++ b/core/persistence-jpa/src/main/resources/domains.xml
@@ -44,7 +44,8 @@ under the License.
         <entry key="openjpa.NontransactionalWrite" value="false"/>
         <entry key="openjpa.AutoDetach" value="close, commit, nontx-read, rollback"/>
 
-        <entry key="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)"/>
+        <!-- Removed: see https://s.apache.org/openjpaSchemaFactory for more information
+        <entry key="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)"/>-->
         <entry key="openjpa.jdbc.MappingDefaults" 
                value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>
                 
@@ -52,7 +53,7 @@ under the License.
         <entry key="openjpa.QueryCache" value="true"/>
         <entry key="openjpa.RemoteCommitProvider" value="sjvm"/>
       </map>
-    </property>    
+    </property>
   </bean>
   
 </beans>

http://git-wip-us.apache.org/repos/asf/syncope/blob/550ee4f4/core/persistence-jpa/src/main/resources/domains/MasterContent.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/resources/domains/MasterContent.xml b/core/persistence-jpa/src/main/resources/domains/MasterContent.xml
index 9a579b1..e6b345b 100644
--- a/core/persistence-jpa/src/main/resources/domains/MasterContent.xml
+++ b/core/persistence-jpa/src/main/resources/domains/MasterContent.xml
@@ -18,107 +18,130 @@ specific language governing permissions and limitations
 under the License.
 -->
 <dataset>
-  <Realm id="1" name="/"/>
+  <Realm key="ea696a4f-e77a-4ef1-be67-8f8093bc8686" name="/"/>
 
-  <SyncopeConf id="1" 
-               creator="admin" lastModifier="admin"
-               creationDate="2014-06-20 11:00:00" lastChangeDate="2014-06-20 11:00:00"/>
+  <SyncopeConf key="cd64d66f-6fff-4008-b966-a06b1cc1436d"/>
 
-  <PlainSchema name="password.cipher.algorithm" type="String"
+  <PlainSchema key="password.cipher.algorithm" type="String"
                mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
-  <CPlainAttr id="1" owner_id="1" schema_name="password.cipher.algorithm"/>
-  <CPlainAttrValue id="1" attribute_id="1" stringValue="SHA1"/>
+  <CPlainAttr key="56db89b9-119e-4923-a16e-f42823b90c66" 
+              owner_key="cd64d66f-6fff-4008-b966-a06b1cc1436d" schema_key="password.cipher.algorithm"/>
+  <CPlainAttrValue key="870323e8-8db6-4a64-b512-15f9fa094905" 
+                   attribute_key="56db89b9-119e-4923-a16e-f42823b90c66" stringValue="SHA1"/>
 
   <!-- notificationjob.cronExpression:
   + not existing: NotificationJob runs according to NotificationJob.DEFAULT_CRON_EXP
   + provided as empty string: NotificationJob disabled
   + provided as non-empty string: NotificationJob runs according to the given value -->
-  <PlainSchema name="notificationjob.cronExpression" type="String"
+  <PlainSchema key="notificationjob.cronExpression" type="String"
                mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"/>
-  <CPlainAttr id="2" owner_id="1" schema_name="notificationjob.cronExpression"/>
-  <CPlainAttrValue id="2" attribute_id="2" stringValue=""/>
+  <CPlainAttr key="abd5a2d2-25ee-48b7-b5ca-76813b54a6f2"
+              owner_key="cd64d66f-6fff-4008-b966-a06b1cc1436d" schema_key="notificationjob.cronExpression"/>
+  <CPlainAttrValue key="4828ea70-d151-4c16-b344-2d07b1956bee"
+                   attribute_key="abd5a2d2-25ee-48b7-b5ca-76813b54a6f2" stringValue=""/>
   
-  <PlainSchema name="notification.maxRetries" type="Long"
+  <PlainSchema key="notification.maxRetries" type="Long"
                mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
-  <CPlainAttr id="3" owner_id="1" schema_name="notification.maxRetries"/>
-  <CPlainAttrValue id="3" attribute_id="3" longValue="3"/>
+  <CPlainAttr key="0523d7e6-af13-4e1e-9edb-e35971aacee7"
+              owner_key="cd64d66f-6fff-4008-b966-a06b1cc1436d" schema_key="notification.maxRetries"/>
+  <CPlainAttrValue key="010e2bdc-0094-4918-bac3-d0d5ea17b54a"
+                   attribute_key="0523d7e6-af13-4e1e-9edb-e35971aacee7" longValue="3"/>
 
-  <PlainSchema name="token.length" type="Long"
+  <PlainSchema key="token.length" type="Long"
                mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
-  <CPlainAttr id="4" owner_id="1" schema_name="token.length"/>
-  <CPlainAttrValue id="4" attribute_id="4" longValue="256"/>
+  <CPlainAttr key="58977caa-dcf7-4ae3-8591-7e3d0a395200"
+              owner_key="cd64d66f-6fff-4008-b966-a06b1cc1436d" schema_key="token.length"/>
+  <CPlainAttrValue key="372e28e0-3af1-4774-b668-81aa84903b75"
+                   attribute_key="58977caa-dcf7-4ae3-8591-7e3d0a395200" longValue="256"/>
 
-  <PlainSchema name="token.expireTime" type="Long"
+  <PlainSchema key="token.expireTime" type="Long"
                mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
-  <CPlainAttr id="5" owner_id="1" schema_name="token.expireTime"/>
-  <CPlainAttrValue id="5" attribute_id="5" longValue="60"/>
+  <CPlainAttr key="01f69abd-df85-4e1b-bb88-ad570594e045"
+              owner_key="cd64d66f-6fff-4008-b966-a06b1cc1436d" schema_key="token.expireTime"/>
+  <CPlainAttrValue key="963970cf-4af6-46bb-875b-a1b758ac8d05"
+                   attribute_key="01f69abd-df85-4e1b-bb88-ad570594e045" longValue="60"/>
 
-  <PlainSchema name="selfRegistration.allowed" type="Boolean"
+  <PlainSchema key="selfRegistration.allowed" type="Boolean"
                mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
-  <CPlainAttr id="6" owner_id="1" schema_name="selfRegistration.allowed"/>
-  <CPlainAttrValue id="6" attribute_id="6" booleanValue="1"/>
+  <CPlainAttr key="7b19cefa-d606-477c-8431-c9464f53fe8b"
+              owner_key="cd64d66f-6fff-4008-b966-a06b1cc1436d" schema_key="selfRegistration.allowed"/>
+  <CPlainAttrValue key="c8b9a0f1-0168-4e2a-95b8-4819fc70e620"
+                   attribute_key="7b19cefa-d606-477c-8431-c9464f53fe8b" booleanValue="1"/>
 
-  <PlainSchema name="passwordReset.allowed" type="Boolean"
+  <PlainSchema key="passwordReset.allowed" type="Boolean"
                mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
-  <CPlainAttr id="7" owner_id="1" schema_name="passwordReset.allowed"/>
-  <CPlainAttrValue id="7" attribute_id="7" booleanValue="1"/>
+  <CPlainAttr key="dc35cc97-6ed9-4bb2-bb3b-509f4cd8f3d3"
+              owner_key="cd64d66f-6fff-4008-b966-a06b1cc1436d" schema_key="passwordReset.allowed"/>
+  <CPlainAttrValue key="b1ecea41-ab7c-4dd3-9e3e-b6baf0f98046"
+                   attribute_key="dc35cc97-6ed9-4bb2-bb3b-509f4cd8f3d3" booleanValue="1"/>
 
-  <PlainSchema name="passwordReset.securityQuestion" type="Boolean"
+  <PlainSchema key="passwordReset.securityQuestion" type="Boolean"
                mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
-  <CPlainAttr id="8" owner_id="1" schema_name="passwordReset.securityQuestion"/>
-  <CPlainAttrValue id="8" attribute_id="8" booleanValue="1"/>
-
-  <PlainSchema name="authentication.statuses" type="String" multivalue="1" uniqueConstraint="0" readonly="0"/>
-  <CPlainAttr id="9" owner_id="1" schema_name="authentication.statuses"/>
-  <CPlainAttrValue id="9" attribute_id="9" stringValue="created"/>
-  <CPlainAttrValue id="10" attribute_id="9" stringValue="active"/>
+  <CPlainAttr key="e5a712ad-53fd-4102-ba55-fb45caed5f7b"
+              owner_key="cd64d66f-6fff-4008-b966-a06b1cc1436d" schema_key="passwordReset.securityQuestion"/>
+  <CPlainAttrValue key="b5e8e79d-8039-4318-9698-fe5e181ebe98"
+                   attribute_key="e5a712ad-53fd-4102-ba55-fb45caed5f7b" booleanValue="1"/>
+
+  <PlainSchema key="authentication.statuses" type="String" multivalue="1" uniqueConstraint="0" readonly="0"/>
+  <CPlainAttr key="888ae8e1-a295-4ee2-a15e-31dbf6dfc3f9"
+              owner_key="cd64d66f-6fff-4008-b966-a06b1cc1436d" schema_key="authentication.statuses"/>
+  <CPlainAttrValue key="4b8e7d2b-f527-43a3-a2e2-5530dcab2f52"
+                   attribute_key="888ae8e1-a295-4ee2-a15e-31dbf6dfc3f9" stringValue="created"/>
+  <CPlainAttrValue key="f0c89f2c-ea87-4c95-a1cf-142bf6e6f523"
+                   attribute_key="888ae8e1-a295-4ee2-a15e-31dbf6dfc3f9" stringValue="active"/>
 
   <!-- Save user login date upon successful authentication -->
-  <PlainSchema name="log.lastlogindate" type="Boolean"
+  <PlainSchema key="log.lastlogindate" type="Boolean"
                mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
-  <CPlainAttr id="11" owner_id="1" schema_name="log.lastlogindate"/>
-  <CPlainAttrValue id="11" attribute_id="11" booleanValue="1"/>
+  <CPlainAttr key="9891c0a7-27ee-4215-9eea-ca32e580b4e4"
+              owner_key="cd64d66f-6fff-4008-b966-a06b1cc1436d" schema_key="log.lastlogindate"/>
+  <CPlainAttrValue key="162dd874-0417-4bb9-9724-db1ff2952dd1"
+                   attribute_key="9891c0a7-27ee-4215-9eea-ca32e580b4e4" booleanValue="1"/>
 
-  <PlainSchema name="tasks.interruptMaxRetries" type="Long"
+  <PlainSchema key="tasks.interruptMaxRetries" type="Long"
                mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
-  <CPlainAttr id="12" owner_id="1" schema_name="tasks.interruptMaxRetries"/>
-  <CPlainAttrValue id="12" attribute_id="12" longValue="20"/>
+  <CPlainAttr key="c2b9ca96-c6ef-433d-8287-0e0cfd0ad0db"
+              owner_key="cd64d66f-6fff-4008-b966-a06b1cc1436d" schema_key="tasks.interruptMaxRetries"/>
+  <CPlainAttrValue key="5dc3f4e3-ff9f-4558-a9ac-15336b63a2ad"
+                   attribute_key="c2b9ca96-c6ef-433d-8287-0e0cfd0ad0db" longValue="20"/>
   
   <!-- Return hashed password values when reading users -->
-  <PlainSchema name="return.password.value" type="Boolean"
+  <PlainSchema key="return.password.value" type="Boolean"
                mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"/>
-  <CPlainAttr id="14" owner_id="1" schema_name="return.password.value"/>
-  <CPlainAttrValue id="14" attribute_id="14" booleanValue="0"/>
+  <CPlainAttr key="bcfd7efc-0605-4b5e-b4bb-85c1d5f6493a"
+              owner_key="cd64d66f-6fff-4008-b966-a06b1cc1436d" schema_key="return.password.value"/>
+  <CPlainAttrValue key="e5fa94db-b524-4309-908d-8198d0b3f779"
+                   attribute_key="bcfd7efc-0605-4b5e-b4bb-85c1d5f6493a" booleanValue="0"/>
   
   <!-- For usage with admin console -->
-  <PlainSchema name="admin.user.layout" type="String"
+  <PlainSchema key="admin.user.layout" type="String"
                mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
-  <PlainSchema name="self.user.layout" type="String"
+  <PlainSchema key="self.user.layout" type="String"
                mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
-  <PlainSchema name="admin.group.layout" type="String"
+  <PlainSchema key="admin.group.layout" type="String"
                mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
-  <PlainSchema name="self.group.layout" type="String"
+  <PlainSchema key="self.group.layout" type="String"
                mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
-  <PlainSchema name="admin.membership.layout" type="String"
+  <PlainSchema key="admin.membership.layout" type="String"
                mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
-  <PlainSchema name="self.membership.layout" type="String"
+  <PlainSchema key="self.membership.layout" type="String"
                mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
 
-  <AnyType name="USER" kind="USER"/>
-  <AnyTypeClass name="BaseUser"/>
-  <AnyType_AnyTypeClass anyType_name="USER" anyTypeClass_name="BaseUser"/>
+  <AnyType key="USER" kind="USER"/>
+  <AnyTypeClass key="BaseUser"/>
+  <AnyType_AnyTypeClass anyType_key="USER" anyTypeClass_key="BaseUser"/>
 
-  <AnyType name="GROUP" kind="GROUP"/>
-  <AnyTypeClass name="BaseGroup"/>
-  <AnyType_AnyTypeClass anyType_name="GROUP" anyTypeClass_name="BaseGroup"/>
+  <AnyType key="GROUP" kind="GROUP"/>
+  <AnyTypeClass key="BaseGroup"/>
+  <AnyType_AnyTypeClass anyType_key="GROUP" anyTypeClass_key="BaseGroup"/>
         
   <!-- Actual plain schemas -->
-  <PlainSchema name="email" type="String" anyTypeClass_name="BaseUser"
+  <PlainSchema key="email" type="String" anyTypeClass_key="BaseUser"
                mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"
                validatorClass="org.apache.syncope.core.persistence.jpa.attrvalue.validation.EmailAddressValidator"/>
   
   <!-- Password reset notifications -->
-  <MailTemplate name="requestPasswordReset"
+  <MailTemplate key="requestPasswordReset"
                 textTemplate="Hi,
 a password reset was request for ${user.getUsername()}.
 
@@ -142,7 +165,7 @@ a password reset was request for ${user.getUsername()}.&lt;/p&gt;
 &lt;p&gt;Best regards.&lt;/p&gt;
 &lt;/body&gt;
 &lt;/html&gt;"/>
-  <MailTemplate name="confirmPasswordReset"
+  <MailTemplate key="confirmPasswordReset"
                 textTemplate="Hi,
 we are happy to inform you that the password request was execute successfully for your account.
 
@@ -156,21 +179,21 @@ we are happy to inform you that the password request was execute successfully fo
 &lt;/body&gt;
 &lt;/html&gt;"/>
 
-  <Notification id="1" active="1" recipientAttrName="email" recipientAttrType="UserPlainSchema" selfAsRecipient="1" 
-                sender="admin@syncope.apache.org" subject="Password Reset request" template_name="requestPasswordReset" 
+  <Notification key="e00945b5-1184-4d43-8e45-4318a8dcdfd4" active="1" recipientAttrName="email" recipientAttrType="UserPlainSchema" selfAsRecipient="1" 
+                sender="admin@syncope.apache.org" subject="Password Reset request" template_key="requestPasswordReset" 
                 traceLevel="FAILURES"/> 
-  <AnyAbout id="1" anyType_name="USER" notification_id="1" filter="token!=$null"/>
-  <Notification_events Notification_id="1" event="[CUSTOM]:[]:[]:[requestPasswordReset]:[SUCCESS]"/>
+  <AnyAbout key="a328f2e6-25e9-4cc1-badf-7425d7be4b39" anyType_key="USER" notification_key="e00945b5-1184-4d43-8e45-4318a8dcdfd4" filter="token!=$null"/>
+  <Notification_events notification_key="e00945b5-1184-4d43-8e45-4318a8dcdfd4" event="[CUSTOM]:[]:[]:[requestPasswordReset]:[SUCCESS]"/>
   
-  <Notification id="2" active="1" recipientAttrName="email" recipientAttrType="UserPlainSchema" selfAsRecipient="1" 
-                sender="admin@syncope.apache.org" subject="Password Reset successful" template_name="confirmPasswordReset" 
+  <Notification key="bef0c250-e8a7-4848-bb63-2564fc409ce2" active="1" recipientAttrName="email" recipientAttrType="UserPlainSchema" selfAsRecipient="1" 
+                sender="admin@syncope.apache.org" subject="Password Reset successful" template_key="confirmPasswordReset" 
                 traceLevel="FAILURES"/> 
-  <Notification_events Notification_id="2" event="[CUSTOM]:[]:[]:[confirmPasswordReset]:[SUCCESS]"/>
+  <Notification_events notification_key="bef0c250-e8a7-4848-bb63-2564fc409ce2" event="[CUSTOM]:[]:[]:[confirmPasswordReset]:[SUCCESS]"/>
 
-  <ReportTemplate name="empty"/>  
+  <ReportTemplate key="empty"/>  
 
-  <Report id="1" name="reconciliation" active="1" template_name="empty"/>
-  <ReportletConfInstance id="1" Report_id="1" 
+  <Report key="c3520ad9-179f-49e7-b315-d684d216dd97" name="reconciliation" active="1" template_key="empty"/>
+  <ReportletConfInstance key="d6c2b475-4860-4eb1-8fde-618299c2a97c" report_key="c3520ad9-179f-49e7-b315-d684d216dd97" 
                          serializedInstance='{"@class":"org.apache.syncope.common.lib.report.ReconciliationReportletConf","name":"dashboardReconciliationReportlet","userMatchingCond":null,"groupMatchingCond":null,"anyObjectMatchingCond":null,"features":["key","username","groupName"]}'/>
 
 </dataset>