Skip to content
Browse files

BZ 771745: Getting Content (LOB) objects in Postgresql needs a TX.

  • Loading branch information...
1 parent a36341a commit 9bb1c89c78ed799a19cb73cbdd0f44fa939becbb @mrietveld mrietveld committed Apr 4, 2012
Showing with 21 additions and 1 deletion.
  1. +21 −1 jbpm-human-task/src/main/java/org/jbpm/task/service/TaskServiceSession.java
View
22 jbpm-human-task/src/main/java/org/jbpm/task/service/TaskServiceSession.java
@@ -539,8 +539,28 @@ public void doOperation() {
});
}
+ /**
+ * This method should only be called from a ServerHandler or TaskService implementation.
+ * </p>
+ * If you need a Content object (and are already running within a tx), then just use
+ * tpm.findEntity(...).
+ *
+ * @param contentId The id of the Content object.
+ * @return The requested Content object.
+ */
public Content getContent(final long contentId) {
- return getEntity(Content.class, contentId);
+ // The Content object contains a LOB which requires a tx in some db's
+
+ final Content [] result = new Content[1];
+ result[0] = null;
+
+ doOperationInTransaction(new TransactedOperation() {
+ public void doOperation() {
+ result[0] = (Content) tpm.findEntity(Content.class, contentId);
+ }
+ });
+
+ return result[0];
}
public void deleteAttachment(final long taskId, final long attachmentId, final long contentId) {

0 comments on commit 9bb1c89

Please sign in to comment.
Something went wrong with that request. Please try again.