#321: remove duplicate contributors

This commit is contained in:
Benjamin Gamard 2019-06-03 11:45:38 +02:00
parent ab72736bcc
commit 6b93e413b6

View File

@ -56,7 +56,7 @@ public class ContributorDao {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public List<ContributorDto> getByDocumentId(String documentId) { public List<ContributorDto> getByDocumentId(String documentId) {
EntityManager em = ThreadLocalContext.get().getEntityManager(); EntityManager em = ThreadLocalContext.get().getEntityManager();
StringBuilder sb = new StringBuilder("select u.USE_USERNAME_C, u.USE_EMAIL_C from T_CONTRIBUTOR c "); StringBuilder sb = new StringBuilder("select distinct u.USE_USERNAME_C, u.USE_EMAIL_C from T_CONTRIBUTOR c ");
sb.append(" join T_USER u on u.USE_ID_C = c.CTR_IDUSER_C "); sb.append(" join T_USER u on u.USE_ID_C = c.CTR_IDUSER_C ");
sb.append(" where c.CTR_IDDOC_C = :documentId "); sb.append(" where c.CTR_IDDOC_C = :documentId ");
Query q = em.createNativeQuery(sb.toString()); Query q = em.createNativeQuery(sb.toString());