mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-12 12:33:18 +00:00
Each of these "READ" endpoints should "autocommit", which prevents transaction abort issues (atleast with postgres).
If you got an error, (i.e. negative limit is bad), then PG will barf always. current transaction is aborted, commands ignored until end of transaction block
This commit is contained in:
@@ -40,6 +40,8 @@ public class BitstreamResource {
|
|||||||
try {
|
try {
|
||||||
if(context == null || !context.isValid()) {
|
if(context == null || !context.isValid()) {
|
||||||
context = new Context();
|
context = new Context();
|
||||||
|
//Failed SQL is ignored as a failed SQL statement, prevent: current transaction is aborted, commands ignored until end of transaction block
|
||||||
|
context.getDBConnection().setAutoCommit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
org.dspace.content.Bitstream bitstream = org.dspace.content.Bitstream.find(context, bitstream_id);
|
org.dspace.content.Bitstream bitstream = org.dspace.content.Bitstream.find(context, bitstream_id);
|
||||||
@@ -62,6 +64,8 @@ public class BitstreamResource {
|
|||||||
try {
|
try {
|
||||||
if(context == null || !context.isValid() ) {
|
if(context == null || !context.isValid() ) {
|
||||||
context = new org.dspace.core.Context();
|
context = new org.dspace.core.Context();
|
||||||
|
//Failed SQL is ignored as a failed SQL statement, prevent: current transaction is aborted, commands ignored until end of transaction block
|
||||||
|
context.getDBConnection().setAutoCommit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
org.dspace.content.Bitstream bitstream = org.dspace.content.Bitstream.find(context, bitstream_id);
|
org.dspace.content.Bitstream bitstream = org.dspace.content.Bitstream.find(context, bitstream_id);
|
||||||
|
@@ -67,6 +67,8 @@ public class CollectionsResource {
|
|||||||
try {
|
try {
|
||||||
if(context == null || !context.isValid() ) {
|
if(context == null || !context.isValid() ) {
|
||||||
context = new org.dspace.core.Context();
|
context = new org.dspace.core.Context();
|
||||||
|
//Failed SQL is ignored as a failed SQL statement, prevent: current transaction is aborted, commands ignored until end of transaction block
|
||||||
|
context.getDBConnection().setAutoCommit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
org.dspace.content.Collection[] collections = org.dspace.content.Collection.findAll(context);
|
org.dspace.content.Collection[] collections = org.dspace.content.Collection.findAll(context);
|
||||||
@@ -81,7 +83,7 @@ public class CollectionsResource {
|
|||||||
return collectionArrayList.toArray(new org.dspace.rest.common.Collection[0]);
|
return collectionArrayList.toArray(new org.dspace.rest.common.Collection[0]);
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.getMessage();
|
log.error(e.getMessage());
|
||||||
throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
|
throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,6 +95,8 @@ public class CollectionsResource {
|
|||||||
try {
|
try {
|
||||||
if(context == null || !context.isValid() ) {
|
if(context == null || !context.isValid() ) {
|
||||||
context = new Context();
|
context = new Context();
|
||||||
|
//Failed SQL is ignored as a failed SQL statement, prevent: current transaction is aborted, commands ignored until end of transaction block
|
||||||
|
context.getDBConnection().setAutoCommit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
org.dspace.content.Collection collection = org.dspace.content.Collection.find(context, collection_id);
|
org.dspace.content.Collection collection = org.dspace.content.Collection.find(context, collection_id);
|
||||||
|
@@ -64,6 +64,8 @@ public class CommunitiesResource {
|
|||||||
try {
|
try {
|
||||||
if(context == null || !context.isValid() ) {
|
if(context == null || !context.isValid() ) {
|
||||||
context = new org.dspace.core.Context();
|
context = new org.dspace.core.Context();
|
||||||
|
//Failed SQL is ignored as a failed SQL statement, prevent: current transaction is aborted, commands ignored until end of transaction block
|
||||||
|
context.getDBConnection().setAutoCommit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
org.dspace.content.Community[] topCommunities = org.dspace.content.Community.findAllTop(context);
|
org.dspace.content.Community[] topCommunities = org.dspace.content.Community.findAllTop(context);
|
||||||
@@ -91,6 +93,8 @@ public class CommunitiesResource {
|
|||||||
try {
|
try {
|
||||||
if(context == null || !context.isValid() ) {
|
if(context == null || !context.isValid() ) {
|
||||||
context = new org.dspace.core.Context();
|
context = new org.dspace.core.Context();
|
||||||
|
//Failed SQL is ignored as a failed SQL statement, prevent: current transaction is aborted, commands ignored until end of transaction block
|
||||||
|
context.getDBConnection().setAutoCommit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
org.dspace.content.Community community = org.dspace.content.Community.find(context, community_id);
|
org.dspace.content.Community community = org.dspace.content.Community.find(context, community_id);
|
||||||
|
@@ -40,6 +40,8 @@ public class HandleResource {
|
|||||||
try {
|
try {
|
||||||
if(context == null || !context.isValid() ) {
|
if(context == null || !context.isValid() ) {
|
||||||
context = new Context();
|
context = new Context();
|
||||||
|
//Failed SQL is ignored as a failed SQL statement, prevent: current transaction is aborted, commands ignored until end of transaction block
|
||||||
|
context.getDBConnection().setAutoCommit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
org.dspace.content.DSpaceObject dso = HandleManager.resolveToObject(context, prefix + "/" + suffix);
|
org.dspace.content.DSpaceObject dso = HandleManager.resolveToObject(context, prefix + "/" + suffix);
|
||||||
|
@@ -37,6 +37,8 @@ public class ItemsResource {
|
|||||||
try {
|
try {
|
||||||
if(context == null || !context.isValid()) {
|
if(context == null || !context.isValid()) {
|
||||||
context = new Context();
|
context = new Context();
|
||||||
|
//Failed SQL is ignored as a failed SQL statement, prevent: current transaction is aborted, commands ignored until end of transaction block
|
||||||
|
context.getDBConnection().setAutoCommit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
org.dspace.content.Item item = org.dspace.content.Item.find(context, item_id);
|
org.dspace.content.Item item = org.dspace.content.Item.find(context, item_id);
|
||||||
|
Reference in New Issue
Block a user