On 23/10/18 18:04, Dmitriy Brashevets wrote:
In code [https://github.com/apache/syncope/blob/443f5a38ea45f15c092c41abb202f897c795c5f2/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java#L397] I noticed that `entityManager().remove(merged);` is called. What is the purpose why you do this? The transaction is rolled back and changes are not added into database.

This is exactly the purpose, e.g. force removal of an entity (user) which is not compliant with one or more of the applicable policies.

Regards.

Maybe you need to detach the managed entity and also remove it from the L2 cache if it is enabled?


Regarding the L2 proposal - please, look at the issue https://issues.apache.org/jira/browse/SYNCOPE-1386
{code:java}
entityManager().detach(merged);
if (entityManager().getEntityManagerFactory().getCache() != null) {
entityManager().getEntityManagerFactory().getCache().evict(JPAUser.class, merged.getKey());
}
{code}

--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
http://home.apache.org/~ilgrosso/

Reply via email to