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 2015/01/12 17:32:03 UTC

[24/52] [abbrv] [partial] syncope git commit: [SYNCOPE-620] Unit tests all in

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAConnInstance.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAConnInstance.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAConnInstance.java
new file mode 100644
index 0000000..2c1e956
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAConnInstance.java
@@ -0,0 +1,268 @@
+/*
+ * 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.server.persistence.jpa.entity;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.persistence.CascadeType;
+import javax.persistence.CollectionTable;
+import javax.persistence.Column;
+import javax.persistence.ElementCollection;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.Lob;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.types.ConnConfProperty;
+import org.apache.syncope.common.lib.types.ConnectorCapability;
+import org.apache.syncope.server.persistence.api.entity.ConnInstance;
+import org.apache.syncope.server.persistence.api.entity.ConnPoolConf;
+import org.apache.syncope.server.persistence.api.entity.ExternalResource;
+import org.apache.syncope.server.persistence.jpa.validation.entity.ConnInstanceCheck;
+import org.apache.syncope.server.misc.serialization.POJOHelper;
+
+@Entity
+@Table(name = JPAConnInstance.TABLE)
+@ConnInstanceCheck
+public class JPAConnInstance extends AbstractEntity<Long> implements ConnInstance {
+
+    private static final long serialVersionUID = -2294708794497208872L;
+
+    public static final String TABLE = "ConnInstance";
+
+    private static final int DEFAULT_TIMEOUT = 10;
+
+    @Id
+    private Long id;
+
+    /**
+     * URI identifying the local / remote ConnId location where the related connector bundle is found.
+     */
+    @Column(nullable = false)
+    private String location;
+
+    /**
+     * Connector bundle class name.
+     * Within a given location, the triple
+     * (ConnectorBundle-Name, ConnectorBundle-Version, ConnectorBundle-Version) must be unique.
+     */
+    @Column(nullable = false)
+    private String connectorName;
+
+    /**
+     * Qualified name for the connector bundle.
+     * Within a given location, the triple
+     * (ConnectorBundle-Name, ConnectorBundle-Version, ConnectorBundle-Version) must be unique.
+     */
+    @Column(nullable = false)
+    private String bundleName;
+
+    /**
+     * Version of the bundle.
+     * Within a given location, the triple
+     * (ConnectorBundle-Name, ConnectorBundle-Version, ConnectorBundle-Version) must be unique.
+     */
+    @Column(nullable = false)
+    private String version;
+
+    /**
+     * The set of capabilities supported by this connector instance.
+     */
+    @ElementCollection(fetch = FetchType.EAGER)
+    @Enumerated(EnumType.STRING)
+    @Column(name = "capabilities")
+    @CollectionTable(name = "ConnInstance_capabilities",
+            joinColumns =
+            @JoinColumn(name = "ConnInstance_id", referencedColumnName = "id"))
+    private Set<ConnectorCapability> capabilities;
+
+    /**
+     * The main configuration for the connector instance. This is directly implemented by the Configuration bean class
+     * which contains annotated ConfigurationProperties.
+     *
+     * @see org.identityconnectors.framework.api.ConfigurationProperty
+     */
+    @Lob
+    private String jsonConf;
+
+    @Column(unique = true)
+    private String displayName;
+
+    /**
+     * External resources associated to the connector.
+     */
+    @OneToMany(cascade = { CascadeType.ALL }, mappedBy = "connector")
+    private List<JPAExternalResource> resources;
+
+    /**
+     * Connector request timeout. It is not applied in case of sync, full reconciliation and search.
+     * DEFAULT_TIMEOUT is the default value to be used in case of unspecified timeout.
+     */
+    private Integer connRequestTimeout = DEFAULT_TIMEOUT;
+
+    private JPAConnPoolConf poolConf;
+
+    public JPAConnInstance() {
+        super();
+
+        capabilities = new HashSet<>();
+        resources = new ArrayList<>();
+    }
+
+    @Override
+    public Long getKey() {
+        return id;
+    }
+
+    @Override
+    public String getLocation() {
+        return location;
+    }
+
+    @Override
+    public void setLocation(final String location) {
+        this.location = location;
+    }
+
+    @Override
+    public String getConnectorName() {
+        return connectorName;
+    }
+
+    @Override
+    public void setConnectorName(final String connectorName) {
+        this.connectorName = connectorName;
+    }
+
+    @Override
+    public String getBundleName() {
+        return bundleName;
+    }
+
+    @Override
+    public void setBundleName(final String bundleName) {
+        this.bundleName = bundleName;
+    }
+
+    @Override
+    public String getVersion() {
+        return version;
+    }
+
+    @Override
+    public void setVersion(final String version) {
+        this.version = version;
+    }
+
+    @Override
+    public Set<ConnConfProperty> getConfiguration() {
+        Set<ConnConfProperty> configuration = Collections.<ConnConfProperty>emptySet();
+        if (!StringUtils.isBlank(jsonConf)) {
+            ConnConfProperty[] deserialized = POJOHelper.deserialize(jsonConf, ConnConfProperty[].class);
+            if (ArrayUtils.isNotEmpty(deserialized)) {
+                configuration = new HashSet<ConnConfProperty>(Arrays.asList(deserialized));
+            }
+        }
+
+        return configuration;
+    }
+
+    @Override
+    public void setConfiguration(final Set<ConnConfProperty> configuration) {
+        jsonConf = POJOHelper.serialize(new HashSet<ConnConfProperty>(configuration));
+    }
+
+    @Override
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    @Override
+    public void setDisplayName(final String displayName) {
+        this.displayName = displayName;
+    }
+
+    @Override
+    public List<? extends ExternalResource> getResources() {
+        return this.resources;
+    }
+
+    @Override
+    public boolean addResource(final ExternalResource resource) {
+        checkType(resource, JPAExternalResource.class);
+        return this.resources.contains((JPAExternalResource) resource)
+                || this.resources.add((JPAExternalResource) resource);
+    }
+
+    @Override
+    public boolean removeResource(final ExternalResource resource) {
+        checkType(resource, JPAExternalResource.class);
+        return this.resources.remove((JPAExternalResource) resource);
+    }
+
+    @Override
+    public boolean addCapability(final ConnectorCapability capabitily) {
+        return capabilities.add(capabitily);
+    }
+
+    @Override
+    public boolean removeCapability(final ConnectorCapability capabitily) {
+        return capabilities.remove(capabitily);
+    }
+
+    @Override
+    public Set<ConnectorCapability> getCapabilities() {
+        return capabilities;
+    }
+
+    @Override
+    public Integer getConnRequestTimeout() {
+        // DEFAULT_TIMEOUT will be returned in case of null timeout:
+        // * instances created by the content loader 
+        // * or with a timeout nullified explicitely
+        return connRequestTimeout == null ? DEFAULT_TIMEOUT : connRequestTimeout;
+    }
+
+    @Override
+    public void setConnRequestTimeout(final Integer timeout) {
+        this.connRequestTimeout = timeout;
+    }
+
+    @Override
+    public ConnPoolConf getPoolConf() {
+        return poolConf;
+    }
+
+    @Override
+    public void setPoolConf(final ConnPoolConf poolConf) {
+        checkType(poolConf, JPAConnPoolConf.class);
+        this.poolConf = (JPAConnPoolConf) poolConf;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAConnPoolConf.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAConnPoolConf.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAConnPoolConf.java
new file mode 100644
index 0000000..a4d0093
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAConnPoolConf.java
@@ -0,0 +1,107 @@
+/*
+ * 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.server.persistence.jpa.entity;
+
+import java.io.Serializable;
+import javax.persistence.Embeddable;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.syncope.server.persistence.api.entity.ConnPoolConf;
+
+@Embeddable
+public class JPAConnPoolConf implements ConnPoolConf, Serializable {
+
+    private static final long serialVersionUID = -34259572059178970L;
+
+    private Integer maxObjects;
+
+    private Integer minIdle;
+
+    private Integer maxIdle;
+
+    private Long maxWait;
+
+    private Long minEvictableIdleTimeMillis;
+
+    @Override
+    public Integer getMaxObjects() {
+        return maxObjects;
+    }
+
+    @Override
+    public void setMaxObjects(final Integer maxObjects) {
+        this.maxObjects = maxObjects;
+    }
+
+    @Override
+    public Integer getMinIdle() {
+        return minIdle;
+    }
+
+    @Override
+    public void setMinIdle(final Integer minIdle) {
+        this.minIdle = minIdle;
+    }
+
+    @Override
+    public Integer getMaxIdle() {
+        return maxIdle;
+    }
+
+    @Override
+    public void setMaxIdle(final Integer maxIdle) {
+        this.maxIdle = maxIdle;
+    }
+
+    @Override
+    public Long getMaxWait() {
+        return maxWait;
+    }
+
+    @Override
+    public void setMaxWait(final Long maxWait) {
+        this.maxWait = maxWait;
+    }
+
+    @Override
+    public Long getMinEvictableIdleTimeMillis() {
+        return minEvictableIdleTimeMillis;
+    }
+
+    @Override
+    public void setMinEvictableIdleTimeMillis(final Long minEvictableIdleTimeMillis) {
+        this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        return EqualsBuilder.reflectionEquals(this, obj);
+    }
+
+    @Override
+    public int hashCode() {
+        return HashCodeBuilder.reflectionHashCode(this);
+    }
+
+    @Override
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAEntitlement.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAEntitlement.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAEntitlement.java
new file mode 100644
index 0000000..38dd882
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAEntitlement.java
@@ -0,0 +1,62 @@
+/*
+ * 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.server.persistence.jpa.entity;
+
+import javax.persistence.Cacheable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import org.apache.syncope.server.persistence.api.entity.Entitlement;
+
+@Entity
+@Table(name = JPAEntitlement.TABLE)
+@Cacheable
+public class JPAEntitlement extends AbstractEntity<String> implements Entitlement {
+
+    private static final long serialVersionUID = 8044745999246422483L;
+
+    public static final String TABLE = "Entitlement";
+
+    @Id
+    private String name;
+
+    @Column(nullable = true)
+    private String description;
+
+    @Override
+    public String getKey() {
+        return name;
+    }
+
+    @Override
+    public void setKey(final String key) {
+        this.name = key;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    @Override
+    public void setDescription(final String description) {
+        this.description = description;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAEntityFactory.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAEntityFactory.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAEntityFactory.java
new file mode 100644
index 0000000..b1128b3
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAEntityFactory.java
@@ -0,0 +1,287 @@
+/*
+ * 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.server.persistence.jpa.entity;
+
+import org.apache.syncope.server.persistence.api.entity.AccountPolicy;
+import org.apache.syncope.server.persistence.api.entity.ConnInstance;
+import org.apache.syncope.server.persistence.api.entity.ConnPoolConf;
+import org.apache.syncope.server.persistence.api.entity.Entitlement;
+import org.apache.syncope.server.persistence.api.entity.Entity;
+import org.apache.syncope.server.persistence.api.entity.EntityFactory;
+import org.apache.syncope.server.persistence.api.entity.ExternalResource;
+import org.apache.syncope.server.persistence.api.entity.Notification;
+import org.apache.syncope.server.persistence.api.entity.PasswordPolicy;
+import org.apache.syncope.server.persistence.api.entity.Policy;
+import org.apache.syncope.server.persistence.api.entity.PushPolicy;
+import org.apache.syncope.server.persistence.api.entity.Report;
+import org.apache.syncope.server.persistence.api.entity.ReportExec;
+import org.apache.syncope.server.persistence.api.entity.ReportletConfInstance;
+import org.apache.syncope.server.persistence.api.entity.SyncPolicy;
+import org.apache.syncope.server.persistence.api.entity.conf.CPlainAttr;
+import org.apache.syncope.server.persistence.api.entity.conf.CPlainAttrUniqueValue;
+import org.apache.syncope.server.persistence.api.entity.conf.CPlainAttrValue;
+import org.apache.syncope.server.persistence.api.entity.conf.CPlainSchema;
+import org.apache.syncope.server.persistence.api.entity.conf.Conf;
+import org.apache.syncope.server.persistence.api.entity.membership.MDerAttr;
+import org.apache.syncope.server.persistence.api.entity.membership.MDerAttrTemplate;
+import org.apache.syncope.server.persistence.api.entity.membership.MDerSchema;
+import org.apache.syncope.server.persistence.api.entity.membership.MPlainAttr;
+import org.apache.syncope.server.persistence.api.entity.membership.MPlainAttrTemplate;
+import org.apache.syncope.server.persistence.api.entity.membership.MPlainAttrUniqueValue;
+import org.apache.syncope.server.persistence.api.entity.membership.MPlainAttrValue;
+import org.apache.syncope.server.persistence.api.entity.membership.MPlainSchema;
+import org.apache.syncope.server.persistence.api.entity.membership.MVirAttr;
+import org.apache.syncope.server.persistence.api.entity.membership.MVirAttrTemplate;
+import org.apache.syncope.server.persistence.api.entity.membership.MVirSchema;
+import org.apache.syncope.server.persistence.api.entity.membership.Membership;
+import org.apache.syncope.server.persistence.api.entity.role.RDerAttr;
+import org.apache.syncope.server.persistence.api.entity.role.RDerAttrTemplate;
+import org.apache.syncope.server.persistence.api.entity.role.RDerSchema;
+import org.apache.syncope.server.persistence.api.entity.role.RMapping;
+import org.apache.syncope.server.persistence.api.entity.role.RMappingItem;
+import org.apache.syncope.server.persistence.api.entity.role.RPlainAttr;
+import org.apache.syncope.server.persistence.api.entity.role.RPlainAttrTemplate;
+import org.apache.syncope.server.persistence.api.entity.role.RPlainAttrUniqueValue;
+import org.apache.syncope.server.persistence.api.entity.role.RPlainAttrValue;
+import org.apache.syncope.server.persistence.api.entity.role.RPlainSchema;
+import org.apache.syncope.server.persistence.api.entity.role.RVirAttr;
+import org.apache.syncope.server.persistence.api.entity.role.RVirAttrTemplate;
+import org.apache.syncope.server.persistence.api.entity.role.RVirSchema;
+import org.apache.syncope.server.persistence.api.entity.role.Role;
+import org.apache.syncope.server.persistence.api.entity.task.NotificationTask;
+import org.apache.syncope.server.persistence.api.entity.task.PropagationTask;
+import org.apache.syncope.server.persistence.api.entity.task.PushTask;
+import org.apache.syncope.server.persistence.api.entity.task.SchedTask;
+import org.apache.syncope.server.persistence.api.entity.task.SyncTask;
+import org.apache.syncope.server.persistence.api.entity.task.TaskExec;
+import org.apache.syncope.server.persistence.api.entity.user.SecurityQuestion;
+import org.apache.syncope.server.persistence.api.entity.user.UDerAttr;
+import org.apache.syncope.server.persistence.api.entity.user.UDerSchema;
+import org.apache.syncope.server.persistence.api.entity.user.UMapping;
+import org.apache.syncope.server.persistence.api.entity.user.UMappingItem;
+import org.apache.syncope.server.persistence.api.entity.user.UPlainAttr;
+import org.apache.syncope.server.persistence.api.entity.user.UPlainAttrUniqueValue;
+import org.apache.syncope.server.persistence.api.entity.user.UPlainAttrValue;
+import org.apache.syncope.server.persistence.api.entity.user.UPlainSchema;
+import org.apache.syncope.server.persistence.api.entity.user.UVirAttr;
+import org.apache.syncope.server.persistence.api.entity.user.UVirSchema;
+import org.apache.syncope.server.persistence.api.entity.user.User;
+import org.apache.syncope.server.persistence.jpa.entity.conf.JPACPlainAttr;
+import org.apache.syncope.server.persistence.jpa.entity.conf.JPACPlainAttrUniqueValue;
+import org.apache.syncope.server.persistence.jpa.entity.conf.JPACPlainAttrValue;
+import org.apache.syncope.server.persistence.jpa.entity.conf.JPACPlainSchema;
+import org.apache.syncope.server.persistence.jpa.entity.conf.JPAConf;
+import org.apache.syncope.server.persistence.jpa.entity.membership.JPAMDerAttr;
+import org.apache.syncope.server.persistence.jpa.entity.membership.JPAMDerAttrTemplate;
+import org.apache.syncope.server.persistence.jpa.entity.membership.JPAMDerSchema;
+import org.apache.syncope.server.persistence.jpa.entity.membership.JPAMPlainAttr;
+import org.apache.syncope.server.persistence.jpa.entity.membership.JPAMPlainAttrTemplate;
+import org.apache.syncope.server.persistence.jpa.entity.membership.JPAMPlainAttrUniqueValue;
+import org.apache.syncope.server.persistence.jpa.entity.membership.JPAMPlainAttrValue;
+import org.apache.syncope.server.persistence.jpa.entity.membership.JPAMPlainSchema;
+import org.apache.syncope.server.persistence.jpa.entity.membership.JPAMVirAttr;
+import org.apache.syncope.server.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
+import org.apache.syncope.server.persistence.jpa.entity.membership.JPAMVirSchema;
+import org.apache.syncope.server.persistence.jpa.entity.membership.JPAMembership;
+import org.apache.syncope.server.persistence.jpa.entity.role.JPARDerAttr;
+import org.apache.syncope.server.persistence.jpa.entity.role.JPARDerAttrTemplate;
+import org.apache.syncope.server.persistence.jpa.entity.role.JPARDerSchema;
+import org.apache.syncope.server.persistence.jpa.entity.role.JPARMapping;
+import org.apache.syncope.server.persistence.jpa.entity.role.JPARMappingItem;
+import org.apache.syncope.server.persistence.jpa.entity.role.JPARPlainAttr;
+import org.apache.syncope.server.persistence.jpa.entity.role.JPARPlainAttrTemplate;
+import org.apache.syncope.server.persistence.jpa.entity.role.JPARPlainAttrUniqueValue;
+import org.apache.syncope.server.persistence.jpa.entity.role.JPARPlainAttrValue;
+import org.apache.syncope.server.persistence.jpa.entity.role.JPARPlainSchema;
+import org.apache.syncope.server.persistence.jpa.entity.role.JPARVirAttr;
+import org.apache.syncope.server.persistence.jpa.entity.role.JPARVirAttrTemplate;
+import org.apache.syncope.server.persistence.jpa.entity.role.JPARVirSchema;
+import org.apache.syncope.server.persistence.jpa.entity.role.JPARole;
+import org.apache.syncope.server.persistence.jpa.entity.task.JPANotificationTask;
+import org.apache.syncope.server.persistence.jpa.entity.task.JPAPropagationTask;
+import org.apache.syncope.server.persistence.jpa.entity.task.JPAPushTask;
+import org.apache.syncope.server.persistence.jpa.entity.task.JPASchedTask;
+import org.apache.syncope.server.persistence.jpa.entity.task.JPASyncTask;
+import org.apache.syncope.server.persistence.jpa.entity.task.JPATaskExec;
+import org.apache.syncope.server.persistence.jpa.entity.user.JPAUDerAttr;
+import org.apache.syncope.server.persistence.jpa.entity.user.JPAUDerSchema;
+import org.apache.syncope.server.persistence.jpa.entity.user.JPAUMapping;
+import org.apache.syncope.server.persistence.jpa.entity.user.JPAUMappingItem;
+import org.apache.syncope.server.persistence.jpa.entity.user.JPAUPlainAttr;
+import org.apache.syncope.server.persistence.jpa.entity.user.JPAUPlainAttrUniqueValue;
+import org.apache.syncope.server.persistence.jpa.entity.user.JPAUPlainAttrValue;
+import org.apache.syncope.server.persistence.jpa.entity.user.JPAUPlainSchema;
+import org.apache.syncope.server.persistence.jpa.entity.user.JPAUVirAttr;
+import org.apache.syncope.server.persistence.jpa.entity.user.JPAUVirSchema;
+import org.apache.syncope.server.persistence.jpa.entity.user.JPAUser;
+import org.springframework.stereotype.Component;
+
+@Component
+public class JPAEntityFactory implements EntityFactory {
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public <KEY, T extends Entity<KEY>> T newEntity(final Class<T> reference) {
+        T result;
+
+        if (reference.equals(User.class)) {
+            result = (T) new JPAUser();
+        } else if (reference.equals(Role.class)) {
+            result = (T) new JPARole();
+        } else if (reference.equals(Membership.class)) {
+            result = (T) new JPAMembership();
+        } else if (reference.equals(Conf.class)) {
+            result = (T) new JPAConf();
+        } else if (reference.equals(Notification.class)) {
+            result = (T) new JPANotification();
+        } else if (reference.equals(Entitlement.class)) {
+            result = (T) new JPAEntitlement();
+        } else if (reference.equals(ExternalResource.class)) {
+            result = (T) new JPAExternalResource();
+        } else if (reference.equals(ConnInstance.class)) {
+            result = (T) new JPAConnInstance();
+        } else if (reference.equals(UPlainSchema.class)) {
+            result = (T) new JPAUPlainSchema();
+        } else if (reference.equals(UPlainAttr.class)) {
+            result = (T) new JPAUPlainAttr();
+        } else if (reference.equals(UPlainAttrValue.class)) {
+            result = (T) new JPAUPlainAttrValue();
+        } else if (reference.equals(UPlainAttrUniqueValue.class)) {
+            result = (T) new JPAUPlainAttrUniqueValue();
+        } else if (reference.equals(UDerSchema.class)) {
+            result = (T) new JPAUDerSchema();
+        } else if (reference.equals(UDerAttr.class)) {
+            result = (T) new JPAUDerAttr();
+        } else if (reference.equals(UVirSchema.class)) {
+            result = (T) new JPAUVirSchema();
+        } else if (reference.equals(UVirAttr.class)) {
+            result = (T) new JPAUVirAttr();
+        } else if (reference.equals(UMapping.class)) {
+            result = (T) new JPAUMapping();
+        } else if (reference.equals(UMappingItem.class)) {
+            result = (T) new JPAUMappingItem();
+        } else if (reference.equals(RPlainSchema.class)) {
+            result = (T) new JPARPlainSchema();
+        } else if (reference.equals(RPlainAttr.class)) {
+            result = (T) new JPARPlainAttr();
+        } else if (reference.equals(RPlainAttrValue.class)) {
+            result = (T) new JPARPlainAttrValue();
+        } else if (reference.equals(RPlainAttrUniqueValue.class)) {
+            result = (T) new JPARPlainAttrUniqueValue();
+        } else if (reference.equals(RPlainAttrTemplate.class)) {
+            result = (T) new JPARPlainAttrTemplate();
+        } else if (reference.equals(RDerAttrTemplate.class)) {
+            result = (T) new JPARDerAttrTemplate();
+        } else if (reference.equals(RVirAttrTemplate.class)) {
+            result = (T) new JPARVirAttrTemplate();
+        } else if (reference.equals(RDerSchema.class)) {
+            result = (T) new JPARDerSchema();
+        } else if (reference.equals(RDerAttr.class)) {
+            result = (T) new JPARDerAttr();
+        } else if (reference.equals(RVirSchema.class)) {
+            result = (T) new JPARVirSchema();
+        } else if (reference.equals(RVirAttr.class)) {
+            result = (T) new JPARVirAttr();
+        } else if (reference.equals(RMapping.class)) {
+            result = (T) new JPARMapping();
+        } else if (reference.equals(RMappingItem.class)) {
+            result = (T) new JPARMappingItem();
+        } else if (reference.equals(MPlainSchema.class)) {
+            result = (T) new JPAMPlainSchema();
+        } else if (reference.equals(MPlainAttr.class)) {
+            result = (T) new JPAMPlainAttr();
+        } else if (reference.equals(MPlainAttrValue.class)) {
+            result = (T) new JPAMPlainAttrValue();
+        } else if (reference.equals(MPlainAttrUniqueValue.class)) {
+            result = (T) new JPAMPlainAttrUniqueValue();
+        } else if (reference.equals(MDerSchema.class)) {
+            result = (T) new JPAMDerSchema();
+        } else if (reference.equals(MDerAttr.class)) {
+            result = (T) new JPAMDerAttr();
+        } else if (reference.equals(MVirSchema.class)) {
+            result = (T) new JPAMVirSchema();
+        } else if (reference.equals(MVirAttr.class)) {
+            result = (T) new JPAMVirAttr();
+        } else if (reference.equals(MPlainAttrTemplate.class)) {
+            result = (T) new JPAMPlainAttrTemplate();
+        } else if (reference.equals(MDerAttrTemplate.class)) {
+            result = (T) new JPAMDerAttrTemplate();
+        } else if (reference.equals(MVirAttrTemplate.class)) {
+            result = (T) new JPAMVirAttrTemplate();
+        } else if (reference.equals(CPlainSchema.class)) {
+            result = (T) new JPACPlainSchema();
+        } else if (reference.equals(CPlainAttr.class)) {
+            result = (T) new JPACPlainAttr();
+        } else if (reference.equals(CPlainAttrValue.class)) {
+            result = (T) new JPACPlainAttrValue();
+        } else if (reference.equals(CPlainAttrUniqueValue.class)) {
+            result = (T) new JPACPlainAttrUniqueValue();
+        } else if (reference.equals(Report.class)) {
+            result = (T) new JPAReport();
+        } else if (reference.equals(ReportExec.class)) {
+            result = (T) new JPAReportExec();
+        } else if (reference.equals(ReportletConfInstance.class)) {
+            result = (T) new JPAReportletConfInstance();
+        } else if (reference.equals(NotificationTask.class)) {
+            result = (T) new JPANotificationTask();
+        } else if (reference.equals(PropagationTask.class)) {
+            result = (T) new JPAPropagationTask();
+        } else if (reference.equals(PushTask.class)) {
+            result = (T) new JPAPushTask();
+        } else if (reference.equals(SyncTask.class)) {
+            result = (T) new JPASyncTask();
+        } else if (reference.equals(SchedTask.class)) {
+            result = (T) new JPASchedTask();
+        } else if (reference.equals(TaskExec.class)) {
+            result = (T) new JPATaskExec();
+        } else if (reference.equals(SecurityQuestion.class)) {
+            result = (T) new JPASecurityQuestion();
+        } else {
+            throw new IllegalArgumentException("Could not find a JPA implementation of " + reference.getName());
+        }
+
+        return result;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public <T extends Policy> T newPolicy(final Class<T> reference, final boolean global) {
+        T result;
+
+        if (reference.equals(AccountPolicy.class)) {
+            result = (T) new JPAAccountPolicy(global);
+        } else if (reference.equals(PasswordPolicy.class)) {
+            result = (T) new JPAPasswordPolicy(global);
+        } else if (reference.equals(PushPolicy.class)) {
+            result = (T) new JPAPushPolicy(global);
+        } else if (reference.equals(SyncPolicy.class)) {
+            result = (T) new JPASyncPolicy(global);
+        } else {
+            throw new IllegalArgumentException("Could not find a JPA implementation of " + reference.getName());
+        }
+
+        return result;
+    }
+
+    @Override
+    public ConnPoolConf newConnPoolConf() {
+        return new JPAConnPoolConf();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAExternalResource.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAExternalResource.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAExternalResource.java
new file mode 100644
index 0000000..15bdf9c
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAExternalResource.java
@@ -0,0 +1,426 @@
+/*
+ * 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.server.persistence.jpa.entity;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.CollectionTable;
+import javax.persistence.Column;
+import javax.persistence.ElementCollection;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.types.ConnConfProperty;
+import org.apache.syncope.common.lib.types.PropagationMode;
+import org.apache.syncope.common.lib.types.TraceLevel;
+import org.apache.syncope.server.persistence.api.entity.AccountPolicy;
+import org.apache.syncope.server.persistence.api.entity.ConnInstance;
+import org.apache.syncope.server.persistence.api.entity.ExternalResource;
+import org.apache.syncope.server.persistence.api.entity.PasswordPolicy;
+import org.apache.syncope.server.persistence.api.entity.SyncPolicy;
+import org.apache.syncope.server.persistence.api.entity.role.RMapping;
+import org.apache.syncope.server.persistence.api.entity.user.UMapping;
+import org.apache.syncope.server.persistence.jpa.validation.entity.ExternalResourceCheck;
+import org.apache.syncope.server.persistence.jpa.entity.role.JPARMapping;
+import org.apache.syncope.server.persistence.jpa.entity.user.JPAUMapping;
+import org.apache.syncope.server.misc.serialization.POJOHelper;
+import org.identityconnectors.framework.common.objects.SyncToken;
+
+/**
+ * Resource for propagation and synchronization.
+ */
+@Entity
+@Table(name = JPAExternalResource.TABLE)
+@ExternalResourceCheck
+public class JPAExternalResource extends AbstractAnnotatedEntity<String> implements ExternalResource {
+
+    private static final long serialVersionUID = -6937712883512073278L;
+
+    public static final String TABLE = "ExternalResource";
+
+    /**
+     * The resource identifier is the name.
+     */
+    @Id
+    private String name;
+
+    /**
+     * Should this resource enforce the mandatory constraints?
+     */
+    @Column(nullable = false)
+    @Basic
+    @Min(0)
+    @Max(1)
+    private Integer enforceMandatoryCondition;
+
+    /**
+     * The resource type is identified by the associated connector.
+     */
+    @ManyToOne(fetch = FetchType.EAGER, cascade = { CascadeType.MERGE })
+    @NotNull
+    private JPAConnInstance connector;
+
+    /**
+     * Mapping for user objects.
+     */
+    @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy = "resource")
+    private JPAUMapping umapping;
+
+    /**
+     * Mapping for role objects.
+     */
+    @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy = "resource")
+    private JPARMapping rmapping;
+
+    /**
+     * Is this resource primary, for propagations?
+     */
+    @Column(nullable = false)
+    @Basic
+    @Min(0)
+    @Max(1)
+    private Integer propagationPrimary;
+
+    /**
+     * Priority index for propagation ordering.
+     */
+    @Column(nullable = false)
+    private Integer propagationPriority;
+
+    /**
+     * Generate random password for propagation, if not provided?
+     */
+    @Column(nullable = false)
+    @Basic
+    @Min(0)
+    @Max(1)
+    private Integer randomPwdIfNotProvided;
+
+    @Enumerated(EnumType.STRING)
+    @Column(nullable = false)
+    private PropagationMode propagationMode;
+
+    @Enumerated(EnumType.STRING)
+    @Column(nullable = false)
+    private TraceLevel createTraceLevel;
+
+    @Enumerated(EnumType.STRING)
+    @Column(nullable = false)
+    private TraceLevel updateTraceLevel;
+
+    @Enumerated(EnumType.STRING)
+    @Column(nullable = false)
+    private TraceLevel deleteTraceLevel;
+
+    @Enumerated(EnumType.STRING)
+    @Column(nullable = false)
+    private TraceLevel syncTraceLevel;
+
+    @ManyToOne(fetch = FetchType.EAGER, optional = true)
+    private JPAPasswordPolicy passwordPolicy;
+
+    @ManyToOne(fetch = FetchType.EAGER, optional = true)
+    private JPAAccountPolicy accountPolicy;
+
+    @ManyToOne(fetch = FetchType.EAGER, optional = true)
+    private JPASyncPolicy syncPolicy;
+
+    /**
+     * Configuration properties that are overridden from the connector instance.
+     */
+    @Lob
+    private String jsonConf;
+
+    /**
+     * SyncToken for calling ConnId's sync() on users.
+     */
+    @Lob
+    private String userializedSyncToken;
+
+    /**
+     * SyncToken for calling ConnId's sync() on roles.
+     */
+    @Lob
+    private String rserializedSyncToken;
+
+    /**
+     * (Optional) classes for PropagationAction.
+     */
+    @ElementCollection(fetch = FetchType.EAGER)
+    @Column(name = "action")
+    @CollectionTable(name = "ExternalResource_PropActions",
+            joinColumns =
+            @JoinColumn(name = "ExternalResource_name", referencedColumnName = "name"))
+    private List<String> propagationActionsClassNames = new ArrayList<>();
+
+    /**
+     * Default constructor.
+     */
+    public JPAExternalResource() {
+        super();
+
+        enforceMandatoryCondition = getBooleanAsInteger(false);
+        propagationPrimary = 0;
+        propagationPriority = 0;
+        randomPwdIfNotProvided = 0;
+        propagationMode = PropagationMode.TWO_PHASES;
+
+        createTraceLevel = TraceLevel.FAILURES;
+        updateTraceLevel = TraceLevel.FAILURES;
+        deleteTraceLevel = TraceLevel.FAILURES;
+        syncTraceLevel = TraceLevel.FAILURES;
+    }
+
+    @Override
+    public boolean isEnforceMandatoryCondition() {
+        return isBooleanAsInteger(enforceMandatoryCondition);
+    }
+
+    @Override
+    public void setEnforceMandatoryCondition(boolean enforceMandatoryCondition) {
+        this.enforceMandatoryCondition = getBooleanAsInteger(enforceMandatoryCondition);
+    }
+
+    @Override
+    public ConnInstance getConnector() {
+        return connector;
+    }
+
+    @Override
+    public void setConnector(final ConnInstance connector) {
+        checkType(connector, JPAConnInstance.class);
+        this.connector = (JPAConnInstance) connector;
+    }
+
+    @Override
+    public UMapping getUmapping() {
+        return umapping;
+    }
+
+    @Override
+    public void setUmapping(final UMapping umapping) {
+        checkType(umapping, JPAUMapping.class);
+        this.umapping = (JPAUMapping) umapping;
+    }
+
+    @Override
+    public RMapping getRmapping() {
+        return rmapping;
+    }
+
+    @Override
+    public void setRmapping(final RMapping rmapping) {
+        checkType(rmapping, JPARMapping.class);
+        this.rmapping = (JPARMapping) rmapping;
+    }
+
+    @Override
+    public boolean isPropagationPrimary() {
+        return isBooleanAsInteger(propagationPrimary);
+    }
+
+    @Override
+    public void setPropagationPrimary(boolean propagationPrimary) {
+        this.propagationPrimary = getBooleanAsInteger(propagationPrimary);
+    }
+
+    @Override
+    public Integer getPropagationPriority() {
+        return propagationPriority;
+    }
+
+    @Override
+    public void setPropagationPriority(Integer propagationPriority) {
+        if (propagationPriority != null) {
+            this.propagationPriority = propagationPriority;
+        }
+    }
+
+    @Override
+    public boolean isRandomPwdIfNotProvided() {
+        return isBooleanAsInteger(randomPwdIfNotProvided);
+    }
+
+    @Override
+    public void setRandomPwdIfNotProvided(boolean randomPwdIfNotProvided) {
+        this.randomPwdIfNotProvided = getBooleanAsInteger(randomPwdIfNotProvided);
+    }
+
+    @Override
+    public PropagationMode getPropagationMode() {
+        return propagationMode;
+    }
+
+    @Override
+    public void setPropagationMode(PropagationMode propagationMode) {
+        this.propagationMode = propagationMode;
+    }
+
+    @Override
+    public String getKey() {
+        return name;
+    }
+
+    @Override
+    public void setKey(final String name) {
+        this.name = name;
+    }
+
+    @Override
+    public TraceLevel getCreateTraceLevel() {
+        return createTraceLevel;
+    }
+
+    @Override
+    public void setCreateTraceLevel(final TraceLevel createTraceLevel) {
+        this.createTraceLevel = createTraceLevel;
+    }
+
+    @Override
+
+    public TraceLevel getDeleteTraceLevel() {
+        return deleteTraceLevel;
+    }
+
+    @Override
+    public void setDeleteTraceLevel(final TraceLevel deleteTraceLevel) {
+        this.deleteTraceLevel = deleteTraceLevel;
+    }
+
+    @Override
+    public TraceLevel getUpdateTraceLevel() {
+        return updateTraceLevel;
+    }
+
+    @Override
+    public void setUpdateTraceLevel(final TraceLevel updateTraceLevel) {
+        this.updateTraceLevel = updateTraceLevel;
+    }
+
+    @Override
+    public TraceLevel getSyncTraceLevel() {
+        return syncTraceLevel;
+    }
+
+    @Override
+    public void setSyncTraceLevel(final TraceLevel syncTraceLevel) {
+        this.syncTraceLevel = syncTraceLevel;
+    }
+
+    @Override
+    public AccountPolicy getAccountPolicy() {
+        return accountPolicy;
+    }
+
+    @Override
+    public void setAccountPolicy(final AccountPolicy accountPolicy) {
+        checkType(accountPolicy, JPAAccountPolicy.class);
+        this.accountPolicy = (JPAAccountPolicy) accountPolicy;
+    }
+
+    @Override
+    public PasswordPolicy getPasswordPolicy() {
+        return passwordPolicy;
+    }
+
+    @Override
+    public void setPasswordPolicy(final PasswordPolicy passwordPolicy) {
+        checkType(passwordPolicy, JPAPasswordPolicy.class);
+        this.passwordPolicy = (JPAPasswordPolicy) passwordPolicy;
+    }
+
+    @Override
+    public SyncPolicy getSyncPolicy() {
+        return syncPolicy;
+    }
+
+    @Override
+    public void setSyncPolicy(final SyncPolicy syncPolicy) {
+        checkType(syncPolicy, JPASyncPolicy.class);
+        this.syncPolicy = (JPASyncPolicy) syncPolicy;
+    }
+
+    @Override
+    public Set<ConnConfProperty> getConnInstanceConfiguration() {
+        return StringUtils.isBlank(jsonConf)
+                ? Collections.<ConnConfProperty>emptySet()
+                : new HashSet<>(Arrays.asList(POJOHelper.deserialize(jsonConf, ConnConfProperty[].class)));
+    }
+
+    @Override
+    public void setConnInstanceConfiguration(final Set<ConnConfProperty> properties) {
+        jsonConf = POJOHelper.serialize(new HashSet<>(properties));
+    }
+
+    @Override
+    public String getSerializedUSyncToken() {
+        return userializedSyncToken;
+    }
+
+    @Override
+    public SyncToken getUsyncToken() {
+        return userializedSyncToken == null
+                ? null
+                : POJOHelper.deserialize(userializedSyncToken, SyncToken.class);
+    }
+
+    @Override
+    public void setUsyncToken(final SyncToken syncToken) {
+        this.userializedSyncToken = syncToken == null ? null : POJOHelper.serialize(syncToken);
+    }
+
+    @Override
+    public String getSerializedRSyncToken() {
+        return rserializedSyncToken;
+    }
+
+    @Override
+    public SyncToken getRsyncToken() {
+        return rserializedSyncToken == null
+                ? null
+                : POJOHelper.deserialize(rserializedSyncToken, SyncToken.class);
+    }
+
+    @Override
+    public void setRsyncToken(final SyncToken syncToken) {
+        this.rserializedSyncToken = syncToken == null ? null : POJOHelper.serialize(syncToken);
+    }
+
+    @Override
+    public List<String> getPropagationActionsClassNames() {
+        return propagationActionsClassNames;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPALogger.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPALogger.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPALogger.java
new file mode 100644
index 0000000..9a95f0a
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPALogger.java
@@ -0,0 +1,80 @@
+/*
+ * 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.server.persistence.jpa.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import org.apache.syncope.common.lib.types.LoggerLevel;
+import org.apache.syncope.common.lib.types.LoggerType;
+import org.apache.syncope.server.persistence.api.entity.Logger;
+
+@Entity
+@Table(name = JPALogger.TABLE)
+public class JPALogger extends AbstractEntity<String> implements Logger {
+
+    private static final long serialVersionUID = 943012777014416027L;
+
+    public static final String TABLE = "SyncopeLogger";
+
+    @Id
+    @Column(name = "logName")
+    private String name;
+
+    @Column(name = "logLevel", nullable = false)
+    @Enumerated(EnumType.STRING)
+    private LoggerLevel level;
+
+    @Column(name = "logType", nullable = false)
+    @Enumerated(EnumType.STRING)
+    private LoggerType type;
+
+    @Override
+    public String getKey() {
+        return name;
+    }
+
+    @Override
+    public void setKey(final String name) {
+        this.name = name;
+    }
+
+    @Override
+    public LoggerLevel getLevel() {
+        return level;
+    }
+
+    @Override
+    public void setLevel(final LoggerLevel level) {
+        this.level = level;
+    }
+
+    @Override
+    public LoggerType getType() {
+        return type;
+    }
+
+    @Override
+    public void setType(final LoggerType type) {
+        this.type = type;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPANotification.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPANotification.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPANotification.java
new file mode 100644
index 0000000..dbd6941
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPANotification.java
@@ -0,0 +1,262 @@
+/*
+ * 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.server.persistence.jpa.entity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Basic;
+import javax.persistence.CollectionTable;
+import javax.persistence.Column;
+import javax.persistence.ElementCollection;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.Table;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.TraceLevel;
+import org.apache.syncope.server.persistence.api.entity.Notification;
+import org.apache.syncope.server.persistence.jpa.validation.entity.NotificationCheck;
+
+@Entity
+@Table(name = JPANotification.TABLE)
+@NotificationCheck
+public class JPANotification extends AbstractEntity<Long> implements Notification {
+
+    private static final long serialVersionUID = 3112582296912757537L;
+
+    public static final String TABLE = "Notification";
+
+    @Id
+    private Long id;
+
+    @ElementCollection(fetch = FetchType.EAGER)
+    @CollectionTable(name = "Notification_events",
+            joinColumns =
+            @JoinColumn(name = "Notification_id", referencedColumnName = "id"))
+    @Column(name = "events")
+    private List<String> events;
+
+    private String userAbout;
+
+    private String roleAbout;
+
+    private String recipients;
+
+    @ElementCollection(fetch = FetchType.EAGER)
+    @CollectionTable(name = "Notification_staticRecipients",
+            joinColumns =
+            @JoinColumn(name = "Notification_id", referencedColumnName = "id"))
+    @Column(name = "staticRecipients")
+    private List<String> staticRecipients;
+
+    @NotNull
+    @Enumerated(EnumType.STRING)
+    private IntMappingType recipientAttrType;
+
+    @NotNull
+    private String recipientAttrName;
+
+    @Column(nullable = false)
+    @Basic
+    @Min(0)
+    @Max(1)
+    private Integer selfAsRecipient;
+
+    @NotNull
+    private String sender;
+
+    @NotNull
+    private String subject;
+
+    @NotNull
+    private String template;
+
+    @NotNull
+    @Enumerated(EnumType.STRING)
+    private TraceLevel traceLevel;
+
+    @Column(nullable = false)
+    @Basic
+    @Min(0)
+    @Max(1)
+    private Integer active;
+
+    public JPANotification() {
+        events = new ArrayList<>();
+        staticRecipients = new ArrayList<>();
+        selfAsRecipient = getBooleanAsInteger(false);
+        active = getBooleanAsInteger(true);
+        traceLevel = TraceLevel.ALL;
+    }
+
+    @Override
+    public Long getKey() {
+        return id;
+    }
+
+    @Override
+    public String getUserAbout() {
+        return userAbout;
+    }
+
+    @Override
+    public void setUserAbout(final String userAbout) {
+        this.userAbout = userAbout;
+    }
+
+    @Override
+    public String getRoleAbout() {
+        return roleAbout;
+    }
+
+    @Override
+    public void setRoleAbout(final String roleAbout) {
+        this.roleAbout = roleAbout;
+    }
+
+    @Override
+    public String getRecipients() {
+        return recipients;
+    }
+
+    @Override
+    public void setRecipients(final String recipients) {
+        this.recipients = recipients;
+    }
+
+    @Override
+    public String getRecipientAttrName() {
+        return recipientAttrName;
+    }
+
+    @Override
+    public void setRecipientAttrName(final String recipientAttrName) {
+        this.recipientAttrName = recipientAttrName;
+    }
+
+    @Override
+    public IntMappingType getRecipientAttrType() {
+        return recipientAttrType;
+    }
+
+    @Override
+
+    public void setRecipientAttrType(final IntMappingType recipientAttrType) {
+        this.recipientAttrType = recipientAttrType;
+    }
+
+    @Override
+    public List<String> getEvents() {
+        return events;
+    }
+
+    @Override
+    public boolean addEvent(final String event) {
+        return event != null && !events.contains(event) && events.add(event);
+    }
+
+    @Override
+    public boolean removeEvent(final String event) {
+        return event != null && events.remove(event);
+    }
+
+    @Override
+    public List<String> getStaticRecipients() {
+        return staticRecipients;
+    }
+
+    @Override
+    public boolean addStaticRecipient(final String staticRecipient) {
+        return staticRecipient != null && !staticRecipients.contains(staticRecipient)
+                && staticRecipients.add(staticRecipient);
+    }
+
+    @Override
+    public boolean removeStaticRecipient(final String staticRecipient) {
+        return staticRecipient != null && staticRecipients.remove(staticRecipient);
+    }
+
+    @Override
+    public boolean isSelfAsRecipient() {
+        return isBooleanAsInteger(selfAsRecipient);
+    }
+
+    @Override
+    public void setSelfAsRecipient(final boolean selfAsRecipient) {
+        this.selfAsRecipient = getBooleanAsInteger(selfAsRecipient);
+    }
+
+    @Override
+    public String getSender() {
+        return sender;
+    }
+
+    @Override
+    public void setSender(final String sender) {
+        this.sender = sender;
+    }
+
+    @Override
+    public String getSubject() {
+        return subject;
+    }
+
+    @Override
+
+    public void setSubject(final String subject) {
+        this.subject = subject;
+    }
+
+    @Override
+    public String getTemplate() {
+        return template;
+    }
+
+    @Override
+    public void setTemplate(final String template) {
+        this.template = template;
+    }
+
+    @Override
+    public TraceLevel getTraceLevel() {
+        return traceLevel;
+    }
+
+    @Override
+    public void setTraceLevel(final TraceLevel traceLevel) {
+        this.traceLevel = traceLevel;
+    }
+
+    @Override
+    public boolean isActive() {
+        return isBooleanAsInteger(active);
+    }
+
+    @Override
+    public void setActive(final boolean active) {
+        this.active = getBooleanAsInteger(active);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAPasswordPolicy.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAPasswordPolicy.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAPasswordPolicy.java
new file mode 100644
index 0000000..c9a92df
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAPasswordPolicy.java
@@ -0,0 +1,43 @@
+/*
+ * 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.server.persistence.jpa.entity;
+
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import org.apache.syncope.common.lib.types.PolicyType;
+import org.apache.syncope.server.persistence.api.entity.PasswordPolicy;
+
+@Entity
+@DiscriminatorValue("PasswordPolicy")
+public class JPAPasswordPolicy extends JPAPolicy implements PasswordPolicy {
+
+    private static final long serialVersionUID = 9138550910385232849L;
+
+    public JPAPasswordPolicy() {
+        this(false);
+    }
+
+    public JPAPasswordPolicy(final boolean global) {
+        super();
+
+        this.type = global
+                ? PolicyType.GLOBAL_PASSWORD
+                : PolicyType.PASSWORD;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAPolicy.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAPolicy.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAPolicy.java
new file mode 100644
index 0000000..fb9be4b
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAPolicy.java
@@ -0,0 +1,90 @@
+/*
+ * 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.server.persistence.jpa.entity;
+
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Lob;
+import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
+import org.apache.syncope.common.lib.types.PolicySpec;
+import org.apache.syncope.common.lib.types.PolicyType;
+import org.apache.syncope.server.persistence.api.entity.Policy;
+import org.apache.syncope.server.persistence.jpa.validation.entity.PolicyCheck;
+import org.apache.syncope.server.misc.serialization.POJOHelper;
+
+@Entity
+@Table(name = JPAPolicy.TABLE)
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(name = "DTYPE")
+@PolicyCheck
+public abstract class JPAPolicy extends AbstractEntity<Long> implements Policy {
+
+    private static final long serialVersionUID = -5844833125843247458L;
+
+    public static final String TABLE = "Policy";
+
+    @Id
+    private Long id;
+
+    @NotNull
+    private String description;
+
+    @NotNull
+    @Enumerated(EnumType.STRING)
+    protected PolicyType type;
+
+    @Lob
+    private String specification;
+
+    @Override
+    public Long getKey() {
+        return id;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    @Override
+    public void setDescription(final String description) {
+        this.description = description;
+    }
+
+    @Override
+    public PolicyType getType() {
+        return type;
+    }
+
+    @Override
+    public <T extends PolicySpec> T getSpecification(final Class<T> reference) {
+        return POJOHelper.deserialize(specification, reference);
+    }
+
+    @Override
+    public void setSpecification(final PolicySpec policy) {
+        this.specification = POJOHelper.serialize(policy);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAPushPolicy.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAPushPolicy.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAPushPolicy.java
new file mode 100644
index 0000000..cc8667c
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAPushPolicy.java
@@ -0,0 +1,42 @@
+/*
+ * 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.server.persistence.jpa.entity;
+
+import javax.persistence.Entity;
+import org.apache.syncope.common.lib.types.PolicyType;
+import org.apache.syncope.server.persistence.api.entity.PushPolicy;
+
+@Entity
+public class JPAPushPolicy extends JPAPolicy implements PushPolicy {
+
+    private static final long serialVersionUID = -5875589156893921113L;
+
+    public JPAPushPolicy() {
+        this(false);
+    }
+
+    public JPAPushPolicy(final boolean global) {
+        super();
+
+        this.type = global
+                ? PolicyType.GLOBAL_PUSH
+                : PolicyType.PUSH;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAReport.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAReport.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAReport.java
new file mode 100644
index 0000000..d045bcf
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAReport.java
@@ -0,0 +1,150 @@
+/*
+ * 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.server.persistence.jpa.entity;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import org.apache.syncope.common.lib.report.ReportletConf;
+import org.apache.syncope.server.persistence.api.entity.Report;
+import org.apache.syncope.server.persistence.api.entity.ReportExec;
+import org.apache.syncope.server.persistence.jpa.validation.entity.ReportCheck;
+
+@Entity
+@Table(name = JPAReport.TABLE)
+@ReportCheck
+public class JPAReport extends AbstractEntity<Long> implements Report {
+
+    private static final long serialVersionUID = -587652654964285834L;
+
+    public static final String TABLE = "Report";
+
+    @Id
+    private Long id;
+
+    @Column(unique = true, nullable = false)
+    private String name;
+
+    @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy = "report")
+    private List<JPAReportletConfInstance> reportletConfs;
+
+    private String cronExpression;
+
+    @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy = "report")
+    private List<JPAReportExec> executions;
+
+    public JPAReport() {
+        super();
+
+        reportletConfs = new ArrayList<>();
+        executions = new ArrayList<>();
+    }
+
+    @Override
+    public Long getKey() {
+        return id;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    @Override
+    public boolean addExec(final ReportExec exec) {
+        checkType(exec, JPAReportExec.class);
+        return exec != null && !executions.contains((JPAReportExec) exec) && executions.add((JPAReportExec) exec);
+    }
+
+    @Override
+    public boolean removeExec(final ReportExec exec) {
+        checkType(exec, JPAReportExec.class);
+        return exec != null && executions.remove((JPAReportExec) exec);
+    }
+
+    @Override
+    public List<? extends ReportExec> getExecs() {
+        return executions;
+    }
+
+    @Override
+    public boolean addReportletConf(final ReportletConf reportletConf) {
+        if (reportletConf == null) {
+            return false;
+        }
+
+        JPAReportletConfInstance instance = new JPAReportletConfInstance();
+        instance.setReport(this);
+        instance.setInstance(reportletConf);
+
+        return reportletConfs.add(instance);
+    }
+
+    @Override
+    public boolean removeReportletConf(final ReportletConf reportletConf) {
+        if (reportletConf == null) {
+            return false;
+        }
+
+        checkType(reportletConf, JPAReportletConfInstance.class);
+
+        JPAReportletConfInstance found = null;
+        for (JPAReportletConfInstance instance : reportletConfs) {
+            if (reportletConf.equals(instance.getInstance())) {
+                found = instance;
+            }
+        }
+
+        return found == null
+                ? false
+                : reportletConfs.remove(found);
+    }
+
+    @Override
+    public List<ReportletConf> getReportletConfs() {
+        List<ReportletConf> result = new ArrayList<>(reportletConfs.size());
+
+        for (JPAReportletConfInstance instance : reportletConfs) {
+            result.add(instance.getInstance());
+        }
+
+        return result;
+    }
+
+    @Override
+    public String getCronExpression() {
+        return cronExpression;
+    }
+
+    @Override
+    public void setCronExpression(final String cronExpression) {
+        this.cronExpression = cronExpression;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAReportExec.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAReportExec.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAReportExec.java
new file mode 100644
index 0000000..346d646
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAReportExec.java
@@ -0,0 +1,87 @@
+/*
+ * 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.server.persistence.jpa.entity;
+
+import javax.persistence.Basic;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.syncope.common.lib.types.ReportExecStatus;
+import org.apache.syncope.server.persistence.api.entity.Report;
+import org.apache.syncope.server.persistence.api.entity.ReportExec;
+
+@Entity
+@Table(name = JPAReportExec.TABLE)
+public class JPAReportExec extends AbstractExec implements ReportExec {
+
+    private static final long serialVersionUID = -6178274296037547769L;
+
+    public static final String TABLE = "ReportExec";
+
+    @Id
+    private Long id;
+
+    /**
+     * The referred report.
+     */
+    @ManyToOne(optional = false)
+    private JPAReport report;
+
+    /**
+     * Report execution result, stored as an XML stream.
+     */
+    @Lob
+    @Basic(fetch = FetchType.LAZY)
+    private Byte[] execResult;
+
+    @Override
+    public Long getKey() {
+        return id;
+    }
+
+    @Override
+    public Report getReport() {
+        return report;
+    }
+
+    @Override
+    public void setReport(final Report report) {
+        checkType(report, JPAReport.class);
+        this.report = (JPAReport) report;
+    }
+
+    @Override
+    public byte[] getExecResult() {
+        return execResult == null ? null : ArrayUtils.toPrimitive(execResult);
+    }
+
+    @Override
+    public void setExecResult(final byte[] execResult) {
+        this.execResult = execResult == null ? null : ArrayUtils.toObject(execResult);
+    }
+
+    @Override
+    public void setStatus(final ReportExecStatus status) {
+        super.setStatus(status.name());
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAReportletConfInstance.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAReportletConfInstance.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAReportletConfInstance.java
new file mode 100644
index 0000000..51f3ec6
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAReportletConfInstance.java
@@ -0,0 +1,77 @@
+/*
+ * 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.server.persistence.jpa.entity;
+
+import org.apache.syncope.server.persistence.api.entity.ReportletConfInstance;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import org.apache.syncope.common.lib.report.ReportletConf;
+import org.apache.syncope.server.persistence.api.entity.Report;
+import org.apache.syncope.server.misc.serialization.POJOHelper;
+
+@Entity
+@Table(name = JPAReportletConfInstance.TABLE)
+public class JPAReportletConfInstance extends AbstractEntity<Long> implements ReportletConfInstance {
+
+    private static final long serialVersionUID = -2436055132955674610L;
+
+    public static final String TABLE = "ReportletConfInstance";
+
+    @Id
+    private Long id;
+
+    @Lob
+    private String serializedInstance;
+
+    @ManyToOne
+    private JPAReport report;
+
+    @Override
+    public Long getKey() {
+        return id;
+    }
+
+    @Override
+    public Report getReport() {
+        return report;
+    }
+
+    @Override
+    public void setReport(final Report report) {
+        checkType(report, JPAReport.class);
+        this.report = (JPAReport) report;
+    }
+
+    @Override
+    public ReportletConf getInstance() {
+        return serializedInstance == null
+                ? null
+                : POJOHelper.deserialize(serializedInstance, ReportletConf.class);
+    }
+
+    @Override
+    public void setInstance(final ReportletConf instance) {
+        this.serializedInstance = instance == null
+                ? null
+                : POJOHelper.serialize(instance);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPASecurityQuestion.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPASecurityQuestion.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPASecurityQuestion.java
new file mode 100644
index 0000000..caeef80
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPASecurityQuestion.java
@@ -0,0 +1,56 @@
+/*
+ * 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.server.persistence.jpa.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import org.apache.syncope.server.persistence.api.entity.user.SecurityQuestion;
+
+@Entity
+@Table(name = JPASecurityQuestion.TABLE)
+public class JPASecurityQuestion extends AbstractEntity<Long> implements SecurityQuestion {
+
+    private static final long serialVersionUID = 7675321820453579744L;
+
+    public static final String TABLE = "SecurityQuestion";
+
+    @Id
+    private Long id;
+
+    @Column(unique = true)
+    private String content;
+
+    @Override
+    public Long getKey() {
+        return id;
+    }
+
+    @Override
+    public String getContent() {
+        return content;
+    }
+
+    @Override
+    public void setContent(final String content) {
+        this.content = content;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPASyncPolicy.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPASyncPolicy.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPASyncPolicy.java
new file mode 100644
index 0000000..8a34814
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPASyncPolicy.java
@@ -0,0 +1,43 @@
+/*
+ * 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.server.persistence.jpa.entity;
+
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import org.apache.syncope.common.lib.types.PolicyType;
+import org.apache.syncope.server.persistence.api.entity.SyncPolicy;
+
+@Entity
+@DiscriminatorValue("SyncPolicy")
+public class JPASyncPolicy extends JPAPolicy implements SyncPolicy {
+
+    private static final long serialVersionUID = -6090413855809521279L;
+
+    public JPASyncPolicy() {
+        this(false);
+    }
+
+    public JPASyncPolicy(final boolean global) {
+        super();
+
+        this.type = global
+                ? PolicyType.GLOBAL_SYNC
+                : PolicyType.SYNC;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAttributableUtilFactory.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAttributableUtilFactory.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAttributableUtilFactory.java
new file mode 100644
index 0000000..27203e5
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/entity/JPAttributableUtilFactory.java
@@ -0,0 +1,85 @@
+/*
+ * 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.server.persistence.jpa.entity;
+
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.server.persistence.api.entity.Attributable;
+import org.apache.syncope.server.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.server.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.server.persistence.api.entity.conf.Conf;
+import org.apache.syncope.server.persistence.api.entity.membership.Membership;
+import org.apache.syncope.server.persistence.api.entity.role.Role;
+import org.apache.syncope.server.persistence.api.entity.user.User;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.springframework.stereotype.Component;
+
+@Component
+public class JPAttributableUtilFactory implements AttributableUtilFactory {
+
+    @Override
+    public AttributableUtil getInstance(final AttributableType type) {
+        return new JPAAttributableUtil(type);
+    }
+
+    @Override
+    public AttributableUtil getInstance(final String attributableType) {
+        return new JPAAttributableUtil(AttributableType.valueOf(attributableType));
+    }
+
+    @Override
+    public AttributableUtil getInstance(final ObjectClass objectClass) {
+        AttributableType type = null;
+        if (ObjectClass.ACCOUNT.equals(objectClass)) {
+            type = AttributableType.USER;
+        }
+        if (ObjectClass.GROUP.equals(objectClass)) {
+            type = AttributableType.ROLE;
+        }
+
+        if (type == null) {
+            throw new IllegalArgumentException("ObjectClass not supported: " + objectClass);
+        }
+
+        return new JPAAttributableUtil(type);
+    }
+
+    @Override
+    public AttributableUtil getInstance(final Attributable<?, ?, ?> attributable) {
+        AttributableType type = null;
+        if (attributable instanceof User) {
+            type = AttributableType.USER;
+        }
+        if (attributable instanceof Role) {
+            type = AttributableType.ROLE;
+        }
+        if (attributable instanceof Membership) {
+            type = AttributableType.MEMBERSHIP;
+        }
+        if (attributable instanceof Conf) {
+            type = AttributableType.CONFIGURATION;
+        }
+
+        if (type == null) {
+            throw new IllegalArgumentException("Attributable type not supported: " + attributable.getClass().getName());
+        }
+
+        return new JPAAttributableUtil(type);
+    }
+
+}