bugfix/only-one-partner-per-person #143

Merged
hsh-michaelhoennig merged 5 commits from bugfix/only-one-partner-per-person into master 2025-01-07 09:30:40 +01:00
Showing only changes of commit ec56369019 - Show all commits

View File

@ -170,19 +170,18 @@ public class CsvDataImport extends ContextBasedTest {
} }
public <T extends BaseEntity> T persistViaEM(final Integer id, final T entity) { public <T extends BaseEntity> T persistViaEM(final Integer id, final T entity) {
//System.out.println("persisting #" + entity.hashCode() + ": " + entity); if (em.contains(entity)) {
if (!em.contains(entity)) { return entity;
em.persist(entity); }
try {
em.persist(entity);
em.flush(); // makes it a bit slower, but produces better error messages
System.out.println("persisted #" + id + " as " + entity.getUuid());
return entity;
} catch (final Exception exc) {
System.err.println("persist failed for #" + id + " as " + entity);
throw exc; // for breakpoints
} }
// uncomment for debugging purposes
// try {
// em.flush(); // makes it slow, but produces better error messages
// System.out.println("persisted #" + entity.hashCode() + " as " + entity.getUuid());
// return entity;
// } catch (final Exception exc) {
// throw exc; // for breakpoints
// }
return entity;
} }
@SneakyThrows @SneakyThrows