remove fast-persist mode, the advantage is negligible
This commit is contained in:
parent
b37674d877
commit
ec56369019
@ -170,20 +170,19 @@ 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)) {
|
|
||||||
em.persist(entity);
|
|
||||||
}
|
|
||||||
// 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;
|
return 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public BaseEntity<HsHostingAsset> persistViaSql(final Integer id, final HsHostingAsset entity) {
|
public BaseEntity<HsHostingAsset> persistViaSql(final Integer id, final HsHostingAsset entity) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user