示例#1
0
 @Override
 public Set<String> findSagas(Class<?> sagaType, AssociationValue associationValue) {
   EntityManager entityManager = entityManagerProvider.getEntityManager();
   List<String> entries =
       entityManager
           .createNamedQuery(FIND_ASSOCIATION_IDS_NAMED_QUERY, String.class)
           .setParameter("associationKey", associationValue.getKey())
           .setParameter("associationValue", associationValue.getValue())
           .setParameter("sagaType", getSagaTypeName(sagaType))
           .getResultList();
   return new TreeSet<>(entries);
 }
示例#2
0
 protected void removeAssociationValue(
     EntityManager entityManager,
     Class<?> sagaType,
     String sagaIdentifier,
     AssociationValue associationValue) {
   int updateCount =
       entityManager
           .createNamedQuery(DELETE_ASSOCIATION_NAMED_QUERY)
           .setParameter("associationKey", associationValue.getKey())
           .setParameter("associationValue", associationValue.getValue())
           .setParameter("sagaType", getSagaTypeName(sagaType))
           .setParameter("sagaId", sagaIdentifier)
           .executeUpdate();
   if (updateCount == 0 && logger.isWarnEnabled()) {
     logger.warn(
         "Wanted to remove association value, but it was already gone: sagaId= {}, key={}, value={}",
         sagaIdentifier,
         associationValue.getKey(),
         associationValue.getValue());
   }
 }