Changed transaction handling for importing entities.
parent
4b6bd259eb
commit
677a187618
|
|
@ -152,7 +152,7 @@ public abstract class AbstractEntityImExporter<T extends Exportable> {
|
||||||
* @see #updateExistingEntity(org.libreccm.imexport.Exportable,
|
* @see #updateExistingEntity(org.libreccm.imexport.Exportable,
|
||||||
* org.libreccm.imexport.Exportable)
|
* org.libreccm.imexport.Exportable)
|
||||||
*/
|
*/
|
||||||
@Transactional(Transactional.TxType.REQUIRES_NEW)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public T importEntity(final String data) throws ImportExpection {
|
public T importEntity(final String data) throws ImportExpection {
|
||||||
try {
|
try {
|
||||||
final T importedEntity = objectMapper.readValue(data,
|
final T importedEntity = objectMapper.readValue(data,
|
||||||
|
|
@ -164,10 +164,12 @@ public abstract class AbstractEntityImExporter<T extends Exportable> {
|
||||||
final T existingEntity = existingEntityResult.get();
|
final T existingEntity = existingEntityResult.get();
|
||||||
updateExistingEntity(existingEntity, importedEntity);
|
updateExistingEntity(existingEntity, importedEntity);
|
||||||
|
|
||||||
|
entityManager.flush();
|
||||||
return existingEntity;
|
return existingEntity;
|
||||||
} else {
|
} else {
|
||||||
saveImportedEntity(importedEntity);
|
saveImportedEntity(importedEntity);
|
||||||
|
|
||||||
|
entityManager.flush();
|
||||||
return importedEntity;
|
return importedEntity;
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue