syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [syncope] 01/02: Avoiding any EntityManager#flush call
Date Tue, 20 Nov 2018 12:19:00 GMT
This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit 11ee88516e4f7ca69ac71751562fffaa17a04fdf
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
AuthorDate: Tue Nov 20 13:11:29 2018 +0100

    Avoiding any EntityManager#flush call
---
 .../syncope/core/persistence/api/dao/DAO.java      |  2 --
 .../core/persistence/jpa/dao/AbstractDAO.java      |  5 ---
 .../core/persistence/jpa/dao/JPAUserDAO.java       | 11 +++---
 .../core/persistence/jpa/inner/AnySearchTest.java  |  2 +-
 .../persistence/jpa/inner/ApplicationTest.java     |  4 +--
 .../jpa/inner/RelationshipTypeTest.java            |  2 +-
 .../persistence/jpa/inner/RemediationTest.java     |  2 +-
 .../persistence/jpa/outer/AccessTokenTest.java     |  4 +--
 .../core/persistence/jpa/outer/AnySearchTest.java  |  4 +--
 .../persistence/jpa/outer/AnyTypeClassTest.java    |  6 ++--
 .../core/persistence/jpa/outer/AnyTypeTest.java    |  5 ++-
 .../core/persistence/jpa/outer/ConfTest.java       |  2 +-
 .../jpa/outer/ConnInstanceHistoryConfTest.java     |  4 +--
 .../persistence/jpa/outer/ConnInstanceTest.java    |  3 +-
 .../core/persistence/jpa/outer/DynRealmTest.java   |  4 +--
 .../core/persistence/jpa/outer/GroupTest.java      | 19 +++++-----
 .../core/persistence/jpa/outer/PlainAttrTest.java  |  4 +--
 .../persistence/jpa/outer/PlainSchemaTest.java     |  8 ++---
 .../core/persistence/jpa/outer/RealmTest.java      |  2 +-
 .../core/persistence/jpa/outer/ReportTest.java     |  8 ++---
 .../jpa/outer/ResourceHistoryConfTest.java         |  4 +--
 .../core/persistence/jpa/outer/ResourceTest.java   | 12 +++----
 .../core/persistence/jpa/outer/RoleTest.java       |  8 ++---
 .../jpa/outer/SecurityQuestionTest.java            |  4 +--
 .../core/persistence/jpa/outer/TaskTest.java       | 12 +++----
 .../core/persistence/jpa/outer/UserTest.java       | 41 +++++++++++++---------
 .../core/persistence/jpa/outer/VirSchemaTest.java  |  2 +-
 .../java/notification/NotificationManagerImpl.java |  2 --
 .../AbstractPropagationTaskExecutor.java           |  2 --
 .../core/provisioning/java/AbstractTest.java       | 15 ++++++++
 .../provisioning/java/ResourceDataBinderTest.java  |  2 +-
 31 files changed, 108 insertions(+), 97 deletions(-)

diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DAO.java
b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DAO.java
index 04ea153..c0f0dca 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DAO.java
@@ -26,7 +26,5 @@ public interface DAO<E extends Entity> {
 
     void detach(E entity);
 
-    void flush();
-
     void clear();
 }
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractDAO.java
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractDAO.java
index 5b16737..fd87b30 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractDAO.java
@@ -55,11 +55,6 @@ public abstract class AbstractDAO<E extends Entity> implements DAO<E>
{
     }
 
     @Override
-    public void flush() {
-        entityManager().flush();
-    }
-
-    @Override
     public void clear() {
         entityManager().clear();
     }
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
index 01e90c7..ede1df0 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
@@ -31,6 +31,7 @@ import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import javax.annotation.Resource;
 import javax.persistence.NoResultException;
+import javax.persistence.PersistenceException;
 import javax.persistence.Query;
 import javax.persistence.TypedQuery;
 import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -321,6 +322,8 @@ public class JPAUserDAO extends AbstractAnyDAO<User> implements
UserDAO {
                     user.getPasswordHistory().remove(i);
                 }
             }
+        } catch (PersistenceException | InvalidEntityException e) {
+            throw e;
         } catch (Exception e) {
             LOG.error("Invalid password for {}", user, e);
             throw new InvalidEntityException(User.class, EntityViolationType.InvalidPassword,
e.getMessage());
@@ -361,10 +364,9 @@ public class JPAUserDAO extends AbstractAnyDAO<User> implements
UserDAO {
                         && user.getFailedLogins() > policy.getMaxAuthenticationAttempts()
&& !user.isSuspended();
                 propagateSuspension |= policy.isPropagateSuspension();
             }
+        } catch (PersistenceException | InvalidEntityException e) {
+            throw e;
         } catch (Exception e) {
-            if (e instanceof InvalidEntityException) {
-                throw (InvalidEntityException) e;
-            }
             LOG.error("Invalid username for {}", user, e);
             throw new InvalidEntityException(User.class, EntityViolationType.InvalidUsername,
e.getMessage());
         }
@@ -376,9 +378,8 @@ public class JPAUserDAO extends AbstractAnyDAO<User> implements
UserDAO {
         // 1. save clear password value before save
         String clearPwd = user.getClearPassword();
 
-        // 2. save and flush to trigger entity validation        
+        // 2. save
         User merged = super.save(user);
-        entityManager().flush();
 
         // 3. set back the sole clear password value
         JPAUser.class.cast(merged).setClearPassword(clearPwd);
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java
index 089b7b4..2c2f4d1 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java
@@ -702,7 +702,7 @@ public class AnySearchTest extends AbstractTest {
         anyObject.add(membership);
         anyObjectDAO.save(anyObject);
 
-        anyObjectDAO.flush();
+        entityManager().flush();
 
         MembershipCond groupCond = new MembershipCond();
         groupCond.setGroup("citizen");
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ApplicationTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ApplicationTest.java
index 057b2e7..eef08cb 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ApplicationTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ApplicationTest.java
@@ -97,7 +97,7 @@ public class ApplicationTest extends AbstractTest {
 
         applicationDAO.save(application);
 
-        applicationDAO.flush();
+        entityManager().flush();
 
         application = applicationDAO.find(application.getKey());
         assertNotNull(application);
@@ -107,7 +107,7 @@ public class ApplicationTest extends AbstractTest {
         // 3. delete application
         applicationDAO.delete(application);
 
-        applicationDAO.flush();
+        entityManager().flush();
 
         assertNull(applicationDAO.find(application.getKey()));
         assertNull(applicationDAO.findPrivilege(privilege1Key));
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/RelationshipTypeTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/RelationshipTypeTest.java
index dce3e09..c1dead2 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/RelationshipTypeTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/RelationshipTypeTest.java
@@ -99,7 +99,7 @@ public class RelationshipTypeTest extends AbstractTest {
 
         relationshipTypeDAO.delete("neighborhood");
 
-        relationshipTypeDAO.flush();
+        entityManager().flush();
 
         anyObject = anyObjectDAO.find("fc6dbc3a-6c07-4965-8781-921e7401a4a5");
         assertNotNull(anyObject);
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/RemediationTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/RemediationTest.java
index cb2484a..15e3e5b 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/RemediationTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/RemediationTest.java
@@ -120,7 +120,7 @@ public class RemediationTest extends AbstractTest {
 
         taskDAO.delete(remediation.getPullTask());
 
-        remediationDAO.flush();
+        entityManager().flush();
 
         remediation = remediationDAO.find(remediation.getKey());
         assertNull(remediation.getPullTask());
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AccessTokenTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AccessTokenTest.java
index 276eef5..9272302 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AccessTokenTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AccessTokenTest.java
@@ -48,7 +48,7 @@ public class AccessTokenTest extends AbstractTest {
         accessToken = accessTokenDAO.save(accessToken);
         assertNotNull(accessToken);
 
-        accessTokenDAO.flush();
+        entityManager().flush();
 
         accessToken = accessTokenDAO.findByOwner("bellini");
         assertNotNull(accessToken);
@@ -56,7 +56,7 @@ public class AccessTokenTest extends AbstractTest {
 
         accessTokenDAO.deleteExpired();
 
-        accessTokenDAO.flush();
+        entityManager().flush();
 
         accessToken = accessTokenDAO.findByOwner("bellini");
         assertNull(accessToken);
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AnySearchTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AnySearchTest.java
index 5d0d6a5..3c0d484 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AnySearchTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AnySearchTest.java
@@ -61,7 +61,7 @@ public class AnySearchTest extends AbstractTest {
         for (Group group : groupDAO.findAll(1, 100)) {
             groupDAO.delete(group.getKey());
         }
-        groupDAO.flush();
+        entityManager().flush();
 
         AttributeCond coolLeafCond = new AttributeCond(AttributeCond.Type.EQ);
         coolLeafCond.setSchema("cool");
@@ -96,7 +96,7 @@ public class AnySearchTest extends AbstractTest {
         role = roleDAO.saveAndRefreshDynMemberships(role);
         assertNotNull(role);
 
-        roleDAO.flush();
+        entityManager().flush();
 
         // 2. search user by this dynamic role
         RoleCond roleCond = new RoleCond();
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AnyTypeClassTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AnyTypeClassTest.java
index 3b9b69d..b4ccb19 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AnyTypeClassTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AnyTypeClassTest.java
@@ -49,7 +49,7 @@ public class AnyTypeClassTest extends AbstractTest {
 
         plainSchemaDAO.save(newSchema);
 
-        plainSchemaDAO.flush();
+        entityManager().flush();
 
         newSchema = plainSchemaDAO.find(newSchema.getKey());
         assertNotNull(newSchema);
@@ -60,7 +60,7 @@ public class AnyTypeClassTest extends AbstractTest {
 
         anyTypeClassDAO.save(newClass);
 
-        anyTypeClassDAO.flush();
+        entityManager().flush();
 
         newClass = anyTypeClassDAO.find(newClass.getKey());
         assertNotNull(newClass);
@@ -84,7 +84,7 @@ public class AnyTypeClassTest extends AbstractTest {
 
         plainSchemaDAO.delete("surname");
 
-        anyTypeClassDAO.flush();
+        entityManager().flush();
 
         minimalUser = anyTypeClassDAO.find("minimal user");
         assertNotNull(minimalUser);
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AnyTypeTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AnyTypeTest.java
index 95a1ad6..5efb5d1 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AnyTypeTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/AnyTypeTest.java
@@ -55,7 +55,7 @@ public class AnyTypeTest extends AbstractTest {
         group.add(other);
         anyTypeDAO.save(group);
 
-        anyTypeDAO.flush();
+        entityManager().flush();
 
         user = anyTypeDAO.findUser();
         assertTrue(user.getClasses().contains(other));
@@ -67,7 +67,7 @@ public class AnyTypeTest extends AbstractTest {
 
         anyTypeClassDAO.delete("other");
 
-        anyTypeDAO.flush();
+        entityManager().flush();
 
         user = anyTypeDAO.findUser();
         assertEquals(userClassesBefore, user.getClasses().size() + 1);
@@ -75,5 +75,4 @@ public class AnyTypeTest extends AbstractTest {
         group = anyTypeDAO.findGroup();
         assertEquals(groupClassesBefore, group.getClasses().size() + 1);
     }
-
 }
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConfTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConfTest.java
index 17e35bb..fefa7ff 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConfTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConfTest.java
@@ -65,7 +65,7 @@ public class ConfTest extends AbstractTest {
         add(attr, String.valueOf(value));
 
         confDAO.save(expireTime);
-        confDAO.flush();
+        entityManager().flush();
 
         CPlainAttr actual = confDAO.find("token.expireTime").get();
         assertEquals(expireTime, actual);
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConnInstanceHistoryConfTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConnInstanceHistoryConfTest.java
index fd20122..1377edd 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConnInstanceHistoryConfTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConnInstanceHistoryConfTest.java
@@ -58,7 +58,7 @@ public class ConnInstanceHistoryConfTest extends AbstractTest {
         ldapHistory = connInstanceHistoryConfDAO.save(ldapHistory);
         assertNotNull(ldapHistory.getKey());
 
-        connInstanceHistoryConfDAO.flush();
+        entityManager().flush();
 
         List<ConnInstanceHistoryConf> history = connInstanceHistoryConfDAO.findByEntity(ldapConnector);
         assertEquals(1, history.size());
@@ -66,7 +66,7 @@ public class ConnInstanceHistoryConfTest extends AbstractTest {
 
         connInstanceHistoryConfDAO.delete(ldapHistory.getKey());
 
-        connInstanceHistoryConfDAO.flush();
+        entityManager().flush();
 
         assertNull(connInstanceHistoryConfDAO.find(ldapHistory.getKey()));
         assertTrue(connInstanceHistoryConfDAO.findByEntity(ldapConnector).isEmpty());
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConnInstanceTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConnInstanceTest.java
index 26ac5c3..8573ed9 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConnInstanceTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConnInstanceTest.java
@@ -25,7 +25,6 @@ import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.util.List;
-import java.util.UUID;
 import org.apache.syncope.common.lib.types.ConnectorCapability;
 import org.apache.syncope.core.persistence.api.dao.ConnInstanceDAO;
 import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
@@ -56,7 +55,7 @@ public class ConnInstanceTest extends AbstractTest {
 
         connInstanceDAO.delete(connInstance.getKey());
 
-        connInstanceDAO.flush();
+        entityManager().flush();
 
         ConnInstance actual = connInstanceDAO.find("fcf9f2b0-f7d6-42c9-84a6-61b28255a42b");
         assertNull(actual);
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/DynRealmTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/DynRealmTest.java
index e20587f..12451db 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/DynRealmTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/DynRealmTest.java
@@ -63,7 +63,7 @@ public class DynRealmTest extends AbstractTest {
         memb.setDynRealm(dynRealm);
         memb.setAnyType(anyTypeDAO.findUser());
         memb.setFIQLCond("cool==true");
-        
+
         dynRealm.add(memb);
         memb.setDynRealm(dynRealm);
 
@@ -79,7 +79,7 @@ public class DynRealmTest extends AbstractTest {
         DynRealm actual = dynRealmDAO.saveAndRefreshDynMemberships(dynRealm);
         assertNotNull(actual);
 
-        dynRealmDAO.flush();
+        entityManager().flush();
 
         DynRealmCond dynRealmCond = new DynRealmCond();
         dynRealmCond.setDynRealm(actual.getKey());
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/GroupTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/GroupTest.java
index e596e2d..c25aead 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/GroupTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/GroupTest.java
@@ -135,7 +135,7 @@ public class GroupTest extends AbstractTest {
 
         groupDAO.save(group);
 
-        groupDAO.flush();
+        entityManager().flush();
 
         group = groupDAO.findByName("new");
         assertNotNull(group);
@@ -150,14 +150,14 @@ public class GroupTest extends AbstractTest {
         group.setRealm(realmDAO.findByFullPath(SyncopeConstants.ROOT_REALM));
 
         groupDAO.save(group);
-        groupDAO.flush();
+        entityManager().flush();
     }
 
     @Test
     public void delete() {
         groupDAO.delete("b1f7c12d-ec83-441f-a50e-1691daaedf3b");
 
-        groupDAO.flush();
+        entityManager().flush();
 
         assertNull(groupDAO.find("b1f7c12d-ec83-441f-a50e-1691daaedf3b"));
         assertEquals(userDAO.findAllGroups(userDAO.findByUsername("verdi")).size(), 2);
@@ -223,7 +223,7 @@ public class GroupTest extends AbstractTest {
         Group actual = groupDAO.saveAndRefreshDynMemberships(group);
         assertNotNull(actual);
 
-        groupDAO.flush();
+        entityManager().flush();
 
         // 2. verify that dynamic membership is there
         actual = groupDAO.find(actual.getKey());
@@ -247,7 +247,7 @@ public class GroupTest extends AbstractTest {
         // 4. delete the new user and verify that dynamic membership was updated
         userDAO.delete(newUserKey);
 
-        userDAO.flush();
+        entityManager().flush();
 
         actual = groupDAO.find(actual.getKey());
         members = groupDAO.findUDynMembers(actual);
@@ -259,7 +259,7 @@ public class GroupTest extends AbstractTest {
 
         groupDAO.delete(actual);
 
-        groupDAO.flush();
+        entityManager().flush();
 
         assertNull(entityManager().find(JPAUDynGroupMembership.class, dynMembershipKey));
 
@@ -325,7 +325,7 @@ public class GroupTest extends AbstractTest {
         Group actual = groupDAO.saveAndRefreshDynMemberships(group);
         assertNotNull(actual);
 
-        groupDAO.flush();
+        entityManager().flush();
 
         // 2. verify that dynamic membership is there
         actual = groupDAO.find(actual.getKey());
@@ -351,7 +351,7 @@ public class GroupTest extends AbstractTest {
         // 4. delete the new any object and verify that dynamic membership was updated
         anyObjectDAO.delete(newAnyObjectKey);
 
-        anyObjectDAO.flush();
+        entityManager().flush();
 
         actual = groupDAO.find(actual.getKey());
         members = groupDAO.findADynMembers(actual).stream().filter(object
@@ -364,12 +364,11 @@ public class GroupTest extends AbstractTest {
 
         groupDAO.delete(actual);
 
-        groupDAO.flush();
+        entityManager().flush();
 
         assertNull(entityManager().find(JPAADynGroupMembership.class, dynMembershipKey));
 
         dynGroupMemberships = findDynGroups(anyObject);
         assertTrue(dynGroupMemberships.isEmpty());
     }
-
 }
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainAttrTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainAttrTest.java
index 58771ca..4dcb57c 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainAttrTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainAttrTest.java
@@ -48,7 +48,7 @@ public class PlainAttrTest extends AbstractTest {
     public void deleteAttr() {
         plainAttrDAO.delete(findPlainAttr("35f407a2-d254-4890-9e45-5a7dd8c8df7d", UPlainAttr.class));
 
-        plainAttrDAO.flush();
+        entityManager().flush();
 
         assertNull(findPlainAttr("35f407a2-d254-4890-9e45-5a7dd8c8df7d", UPlainAttr.class));
         assertNull(findPlainAttrValue("0c67225a-030a-4c56-b337-17cf7a311f0f", UPlainAttrValue.class));
@@ -66,7 +66,7 @@ public class PlainAttrTest extends AbstractTest {
 
         // by removing all values, the related attribute is not valid any more
         try {
-            plainAttrValueDAO.flush();
+            entityManager().flush();
             fail();
         } catch (InvalidEntityException e) {
             assertNotNull(e);
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainSchemaTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainSchemaTest.java
index 39aa303..e84f882 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainSchemaTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainSchemaTest.java
@@ -103,7 +103,7 @@ public class PlainSchemaTest extends AbstractTest {
         plainSchemaDAO.save(schema);
 
         try {
-            plainSchemaDAO.flush();
+            entityManager().flush();
             fail("This should not happen");
         } catch (Exception e) {
             assertTrue(e instanceof EntityExistsException || e.getCause() instanceof EntityExistsException);
@@ -146,7 +146,7 @@ public class PlainSchemaTest extends AbstractTest {
         // delete user schema fullname
         plainSchemaDAO.delete("fullname");
 
-        plainSchemaDAO.flush();
+        entityManager().flush();
 
         // check for schema deletion
         schema = plainSchemaDAO.find("fullname");
@@ -205,7 +205,7 @@ public class PlainSchemaTest extends AbstractTest {
         // delete user schema fullname
         plainSchemaDAO.delete("surname");
 
-        plainSchemaDAO.flush();
+        entityManager().flush();
 
         // check for schema deletion
         schema = plainSchemaDAO.find("surname");
@@ -224,7 +224,7 @@ public class PlainSchemaTest extends AbstractTest {
         plainSchemaDAO.delete("firstname");
         assertNull(plainSchemaDAO.find("firstname"));
 
-        plainSchemaDAO.flush();
+        entityManager().flush();
 
         assertEquals(5, resourceDAO.find("resource-db-pull").
                 getProvision(anyTypeDAO.findUser()).get().getMapping().getItems().size());
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmTest.java
index 971f9a2..3184e57 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RealmTest.java
@@ -63,7 +63,7 @@ public class RealmTest extends AbstractTest {
 
         realmDAO.delete(realm);
 
-        realmDAO.flush();
+        entityManager().flush();
 
         role = roleDAO.find("User reviewer");
         assertEquals(beforeSize - 1, role.getRealms().size());
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ReportTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ReportTest.java
index f3ac215..76ae60f 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ReportTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ReportTest.java
@@ -73,7 +73,7 @@ public class ReportTest extends AbstractTest {
             report.setTemplate(reportTemplateDAO.find("sample"));
 
             reportDAO.save(report);
-            reportDAO.flush();
+            entityManager().flush();
         });
     }
 
@@ -92,7 +92,7 @@ public class ReportTest extends AbstractTest {
         report.add(reportExec);
         reportDAO.save(report);
 
-        reportDAO.flush();
+        entityManager().flush();
 
         report = reportDAO.find("0062ea9c-924d-4ecf-9961-4492a8cc6d1b");
         assertNotNull(report);
@@ -103,7 +103,7 @@ public class ReportTest extends AbstractTest {
     public void deleteReport() {
         reportDAO.delete("0062ea9c-924d-4ecf-9961-4492a8cc6d1b");
 
-        reportDAO.flush();
+        entityManager().flush();
 
         assertNull(reportDAO.find("0062ea9c-924d-4ecf-9961-4492a8cc6d1b"));
         assertNull(reportExecDAO.find("0062ea9c-924d-4ecf-9961-4492a8cc6d1b"));
@@ -116,7 +116,7 @@ public class ReportTest extends AbstractTest {
 
         reportExecDAO.delete("c13f39c5-0d35-4bff-ba79-3cd5de940369");
 
-        reportExecDAO.flush();
+        entityManager().flush();
 
         assertNull(reportExecDAO.find("0062ea9c-924d-4ecf-9961-4492a8cc6d1b"));
 
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ResourceHistoryConfTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ResourceHistoryConfTest.java
index d5cad6d..8689ddd 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ResourceHistoryConfTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ResourceHistoryConfTest.java
@@ -58,7 +58,7 @@ public class ResourceHistoryConfTest extends AbstractTest {
         ldapHistory = resourceHistoryConfDAO.save(ldapHistory);
         assertNotNull(ldapHistory.getKey());
 
-        resourceHistoryConfDAO.flush();
+        entityManager().flush();
 
         List<ExternalResourceHistoryConf> history = resourceHistoryConfDAO.findByEntity(ldapResource);
         assertEquals(1, history.size());
@@ -66,7 +66,7 @@ public class ResourceHistoryConfTest extends AbstractTest {
 
         resourceHistoryConfDAO.delete(ldapHistory.getKey());
 
-        resourceHistoryConfDAO.flush();
+        entityManager().flush();
 
         assertNull(resourceHistoryConfDAO.find(ldapHistory.getKey()));
         assertTrue(resourceHistoryConfDAO.findByEntity(ldapResource).isEmpty());
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ResourceTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ResourceTest.java
index 5fa8b8c..559a041 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ResourceTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ResourceTest.java
@@ -157,7 +157,7 @@ public class ResourceTest extends AbstractTest {
         assertNotNull(actual);
         assertNotNull(actual.getProvision(anyTypeDAO.findUser()).get().getMapping());
 
-        resourceDAO.flush();
+        entityManager().flush();
         resourceDAO.detach(actual);
         connInstanceDAO.detach(connector);
 
@@ -167,7 +167,7 @@ public class ResourceTest extends AbstractTest {
 
         user.add(actual);
 
-        resourceDAO.flush();
+        entityManager().flush();
 
         // retrieve resource
         resource = resourceDAO.find(actual.getKey());
@@ -224,7 +224,7 @@ public class ResourceTest extends AbstractTest {
         resourceDAO.delete(resource.getKey());
 
         // close the transaction
-        resourceDAO.flush();
+        entityManager().flush();
 
         // resource must be removed
         ExternalResource actual = resourceDAO.find("resource-testdb");
@@ -272,7 +272,7 @@ public class ResourceTest extends AbstractTest {
         ldap.getProvisions().remove(groupProvision);
 
         resourceDAO.save(ldap);
-        resourceDAO.flush();
+        entityManager().flush();
 
         itemKeys.forEach(itemKey -> assertNull(entityManager().find(JPAMappingItem.class,
itemKey)));
     }
@@ -290,7 +290,7 @@ public class ResourceTest extends AbstractTest {
         resource.setOrgUnit(null);
 
         resourceDAO.save(resource);
-        resourceDAO.flush();
+        entityManager().flush();
 
         resource = resourceDAO.find("resource-ldap-orgunit");
         assertNull(resource.getOrgUnit());
@@ -312,7 +312,7 @@ public class ResourceTest extends AbstractTest {
         csv.getProvision(anyTypeDAO.findUser()).get().getMapping().add(newMapItem);
 
         resourceDAO.save(csv);
-        resourceDAO.flush();
+        entityManager().flush();
 
         csv = resourceDAO.find("resource-csv");
         assertNotNull(csv);
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RoleTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RoleTest.java
index 0150ff7..5c21a76 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RoleTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RoleTest.java
@@ -124,7 +124,7 @@ public class RoleTest extends AbstractTest {
         Role actual = roleDAO.saveAndRefreshDynMemberships(role);
         assertNotNull(actual);
 
-        roleDAO.flush();
+        entityManager().flush();
 
         // 2. verify that dynamic membership is there
         actual = roleDAO.find(actual.getKey());
@@ -149,7 +149,7 @@ public class RoleTest extends AbstractTest {
         // 4. delete the new user and verify that dynamic membership was updated
         userDAO.delete(newUserKey);
 
-        userDAO.flush();
+        entityManager().flush();
 
         actual = roleDAO.find(actual.getKey());
         members = roleDAO.findDynMembers(actual);
@@ -161,7 +161,7 @@ public class RoleTest extends AbstractTest {
 
         roleDAO.delete(actual);
 
-        roleDAO.flush();
+        entityManager().flush();
 
         assertNull(entityManager().find(JPADynRoleMembership.class, dynMembershipKey));
 
@@ -194,7 +194,7 @@ public class RoleTest extends AbstractTest {
         // 2. remove role
         roleDAO.delete(role);
 
-        userDAO.flush();
+        entityManager().flush();
 
         // 3. verify that role was removed from user
         user = userDAO.find(user.getKey());
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/SecurityQuestionTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/SecurityQuestionTest.java
index 3d49e96..2c03942 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/SecurityQuestionTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/SecurityQuestionTest.java
@@ -47,11 +47,11 @@ public class SecurityQuestionTest extends AbstractTest {
         user.setSecurityAnswer("Rossi");
         userDAO.save(user);
 
-        userDAO.flush();
+        entityManager().flush();
 
         securityQuestionDAO.delete("887028ea-66fc-41e7-b397-620d7ea6dfbb");
 
-        userDAO.flush();
+        entityManager().flush();
 
         user = userDAO.findByUsername("bellini");
 
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/TaskTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/TaskTest.java
index d48cdf9..6785746 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/TaskTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/TaskTest.java
@@ -133,7 +133,7 @@ public class TaskTest extends AbstractTest {
         PropagationTask actual = taskDAO.find(task.getKey());
         assertEquals(task, actual);
 
-        taskDAO.flush();
+        entityManager().flush();
 
         resource = resourceDAO.find("ws-target-resource-1");
         assertTrue(taskDAO.findAll(
@@ -155,7 +155,7 @@ public class TaskTest extends AbstractTest {
         task.add(execution);
 
         taskDAO.save(task);
-        taskDAO.flush();
+        entityManager().flush();
 
         task = taskDAO.find("1e697572-b896-484c-ae7f-0c8f63fcbc6c");
         assertNotNull(task);
@@ -178,7 +178,7 @@ public class TaskTest extends AbstractTest {
         task.add(execution);
 
         taskDAO.save(task);
-        taskDAO.flush();
+        entityManager().flush();
 
         task = taskDAO.find("c41b9b71-9bfa-4f90-89f2-84787def4c5c");
         assertNotNull(task);
@@ -201,7 +201,7 @@ public class TaskTest extends AbstractTest {
         task.add(execution);
 
         taskDAO.save(task);
-        taskDAO.flush();
+        entityManager().flush();
 
         task = taskDAO.find("af558be4-9d2f-4359-bf85-a554e6e90be1");
         assertNotNull(task);
@@ -213,7 +213,7 @@ public class TaskTest extends AbstractTest {
     public void deleteTask() {
         taskDAO.delete("1e697572-b896-484c-ae7f-0c8f63fcbc6c");
 
-        taskDAO.flush();
+        entityManager().flush();
 
         assertNull(taskDAO.find("1e697572-b896-484c-ae7f-0c8f63fcbc6c"));
         assertNull(taskExecDAO.find("e58ca1c7-178a-4012-8a71-8aa14eaf0655"));
@@ -226,7 +226,7 @@ public class TaskTest extends AbstractTest {
 
         taskExecDAO.delete("e58ca1c7-178a-4012-8a71-8aa14eaf0655");
 
-        taskExecDAO.flush();
+        entityManager().flush();
 
         assertNull(taskExecDAO.find("e58ca1c7-178a-4012-8a71-8aa14eaf0655"));
 
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/UserTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/UserTest.java
index e6281b9..46c2444 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/UserTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/UserTest.java
@@ -75,7 +75,7 @@ public class UserTest extends AbstractTest {
 
         userDAO.delete("c9b2dec2-00a7-4855-97c0-d854842b4b24");
 
-        userDAO.flush();
+        entityManager().flush();
 
         assertNull(userDAO.findByUsername("bellini"));
         assertNull(findPlainAttr(UUID.randomUUID().toString(), UPlainAttr.class));
@@ -104,7 +104,7 @@ public class UserTest extends AbstractTest {
 
         userDAO.save(user);
 
-        userDAO.flush();
+        entityManager().flush();
 
         user = userDAO.findByUsername("bellini");
         assertEquals(1, user.getMemberships().size());
@@ -126,7 +126,7 @@ public class UserTest extends AbstractTest {
 
         userDAO.save(user);
 
-        userDAO.flush();
+        entityManager().flush();
 
         user = userDAO.findByUsername("bellini");
         assertEquals(1, user.getRelationships().size());
@@ -136,10 +136,10 @@ public class UserTest extends AbstractTest {
     }
 
     @Test
-    public void membershipWithAttrs() {
+    public void membershipWithAttrNotAllowed() {
         User user = userDAO.findByUsername("vivaldi");
         assertNotNull(user);
-        assertTrue(user.getMemberships().isEmpty());
+        user.getMemberships().clear();
 
         // add 'obscure' to user (no membership): works because 'obscure' is from 'other',
default class for USER
         UPlainAttr attr = entityFactory.newEntity(UPlainAttr.class);
@@ -168,15 +168,24 @@ public class UserTest extends AbstractTest {
         } catch (InvalidEntityException e) {
             assertNotNull(e);
         }
+        entityManager().flush();
+    }
 
-        // replace 'artDirector' with 'additional', which defines type extension with class
'other' and 'csv':
-        // now it works
-        membership = user.getMembership(groupDAO.findByName("artDirector").getKey()).get();
-        user.remove(user.getPlainAttr("obscure", membership).get());
-        user.getMemberships().remove(membership);
-        membership.setLeftEnd(null);
+    @Test
+    public void membershipWithAttr() {
+        User user = userDAO.findByUsername("vivaldi");
+        assertNotNull(user);
+        user.getMemberships().clear();
 
-        membership = entityFactory.newEntity(UMembership.class);
+        // add 'obscure' (no membership): works because 'obscure' is from 'other', default
class for USER
+        UPlainAttr attr = entityFactory.newEntity(UPlainAttr.class);
+        attr.setOwner(user);
+        attr.setSchema(plainSchemaDAO.find("obscure"));
+        attr.add("testvalue", anyUtilsFactory.getInstance(AnyTypeKind.USER));
+        user.add(attr);
+
+        // add 'obscure' (via 'additional' membership): that group defines type extension
with classes 'other' and 'csv'
+        UMembership membership = entityFactory.newEntity(UMembership.class);
         membership.setLeftEnd(user);
         membership.setRightEnd(groupDAO.findByName("additional"));
         user.add(membership);
@@ -189,7 +198,7 @@ public class UserTest extends AbstractTest {
         user.add(attr);
 
         userDAO.save(user);
-        userDAO.flush();
+        entityManager().flush();
 
         user = userDAO.findByUsername("vivaldi");
         assertEquals(1, user.getMemberships().size());
@@ -215,7 +224,7 @@ public class UserTest extends AbstractTest {
         prefix.setExpression("'k' + firstname");
 
         derSchemaDAO.save(prefix);
-        derSchemaDAO.flush();
+        entityManager().flush();
 
         // create derived attribute (literal as suffix)
         DerSchema suffix = entityFactory.newEntity(DerSchema.class);
@@ -223,7 +232,7 @@ public class UserTest extends AbstractTest {
         suffix.setExpression("firstname + 'k'");
 
         derSchemaDAO.save(suffix);
-        derSchemaDAO.flush();
+        entityManager().flush();
 
         // add derived attributes to user
         User owner = userDAO.findByUsername("vivaldi");
@@ -255,7 +264,7 @@ public class UserTest extends AbstractTest {
 
         userDAO.save(user);
 
-        userDAO.flush();
+        entityManager().flush();
 
         user = userDAO.findByUsername("rossini");
         Date afterwards = user.getLastChangeDate();
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/VirSchemaTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/VirSchemaTest.java
index 7522f45..b9e6f40 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/VirSchemaTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/VirSchemaTest.java
@@ -59,7 +59,7 @@ public class VirSchemaTest extends AbstractTest {
         virSchema.setProvision(provision);
 
         virSchemaDAO.save(virSchema);
-        virSchemaDAO.flush();
+        entityManager().flush();
 
         virSchema = virSchemaDAO.find("vSchema");
         assertNotNull(virSchema);
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
index 67b97ed..8647287 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
@@ -445,8 +445,6 @@ public class NotificationManagerImpl implements NotificationManager {
         task.add(execution);
         task.setExecuted(true);
         taskDAO.save(task);
-        // this flush call is needed to generate a value for the execution key
-        taskDAO.flush();
         return execution;
     }
 
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
index 805b772..7127fa0 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
@@ -500,8 +500,6 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
                 task.add(execution);
 
                 taskDAO.save(task);
-                // needed to generate a value for the execution key
-                taskDAO.flush();
             }
 
             if (reporter != null) {
diff --git a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/AbstractTest.java
b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/AbstractTest.java
index c8147ee..ad660e7 100644
--- a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/AbstractTest.java
+++ b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/AbstractTest.java
@@ -18,6 +18,10 @@
  */
 package org.apache.syncope.core.provisioning.java;
 
+import javax.persistence.EntityManager;
+import org.apache.syncope.core.spring.ApplicationContextProvider;
+import org.apache.syncope.core.spring.security.AuthContextUtils;
+import org.springframework.orm.jpa.EntityManagerFactoryUtils;
 import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
 
 @SpringJUnitConfig(locations = {
@@ -27,4 +31,15 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
     "classpath:provisioningTest.xml"
 })
 public abstract class AbstractTest {
+
+    protected EntityManager entityManager() {
+        EntityManager entityManager = EntityManagerFactoryUtils.getTransactionalEntityManager(
+                EntityManagerFactoryUtils.findEntityManagerFactory(
+                        ApplicationContextProvider.getBeanFactory(), AuthContextUtils.getDomain()));
+        if (entityManager == null) {
+            throw new IllegalStateException("Could not find EntityManager for domain " +
AuthContextUtils.getDomain());
+        }
+
+        return entityManager;
+    }
 }
diff --git a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ResourceDataBinderTest.java
b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ResourceDataBinderTest.java
index 3677094..4ebb037 100644
--- a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ResourceDataBinderTest.java
+++ b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ResourceDataBinderTest.java
@@ -129,7 +129,7 @@ public class ResourceDataBinderTest extends AbstractTest {
         assertNotNull(resource.getProvision(anyTypeDAO.findUser()).get().getMapping());
         assertEquals(1, resource.getProvision(anyTypeDAO.findUser()).get().getMapping().getItems().size());
 
-        resourceDAO.flush();
+        entityManager().flush();
 
         ExternalResource actual = resourceDAO.find("resource-issue42");
         assertNotNull(actual);


Mime
View raw message