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,
|
||||
* org.libreccm.imexport.Exportable)
|
||||
*/
|
||||
@Transactional(Transactional.TxType.REQUIRES_NEW)
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public T importEntity(final String data) throws ImportExpection {
|
||||
try {
|
||||
final T importedEntity = objectMapper.readValue(data,
|
||||
|
|
@ -164,10 +164,12 @@ public abstract class AbstractEntityImExporter<T extends Exportable> {
|
|||
final T existingEntity = existingEntityResult.get();
|
||||
updateExistingEntity(existingEntity, importedEntity);
|
||||
|
||||
|
||||
entityManager.flush();
|
||||
return existingEntity;
|
||||
} else {
|
||||
saveImportedEntity(importedEntity);
|
||||
|
||||
entityManager.flush();
|
||||
return importedEntity;
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue