mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-15 05:53:08 +00:00
DS-3740 add commit transaction on create method
This commit is contained in:
@@ -119,13 +119,20 @@ extends AbstractDSpaceRestRepository
|
||||
|
||||
public abstract DSpaceResource<T> wrapResource(T model, String... rels);
|
||||
|
||||
public RestModel createAndReturn() {
|
||||
public T createAndReturn() {
|
||||
Context context = obtainContext();
|
||||
return createAndReturn(context);
|
||||
T entity = createAndReturn(context);
|
||||
try {
|
||||
context.commit();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
protected RestModel createAndReturn(Context context) {
|
||||
protected T createAndReturn(Context context) {
|
||||
//nothing default implementation
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user