From 3384470f6b98a30e57da12e3306dbfd52b3f7b04 Mon Sep 17 00:00:00 2001 From: szymonsztuka Date: Thu, 24 Jan 2019 10:23:26 +0000 Subject: [PATCH] CORDA-2490 Attachment in the directory fails to correctly upload (#4627) (#4629) The column 'uploader' was marked as not updatable entity so any update wasn't propagated to the database when the attachment was uploaded again and the uploader field was changed to a trusted one. Also 'saveOrUpdate' removed, the entity is already managed, saveOrUpdate is for detached/new entity. (cherry picked from commit 9f4c8bcea5bb780eec1c1f663302ed92f2c38733) --- .../corda/node/services/persistence/NodeAttachmentService.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/node/src/main/kotlin/net/corda/node/services/persistence/NodeAttachmentService.kt b/node/src/main/kotlin/net/corda/node/services/persistence/NodeAttachmentService.kt index 62d5367a4e..c59c3dc5e1 100644 --- a/node/src/main/kotlin/net/corda/node/services/persistence/NodeAttachmentService.kt +++ b/node/src/main/kotlin/net/corda/node/services/persistence/NodeAttachmentService.kt @@ -96,7 +96,7 @@ class NodeAttachmentService( @Column(name = "insertion_date", nullable = false, updatable = false) var insertionDate: Instant = Instant.now(), - @Column(name = "uploader", updatable = false, nullable = true) + @Column(name = "uploader", nullable = true) var uploader: String? = null, @Column(name = "filename", updatable = false, nullable = true) @@ -381,7 +381,6 @@ class NodeAttachmentService( if (attachment.uploader != uploader) { verifyVersionUniquenessForSignedAttachments(contractClassNames, attachment.version, attachment.signers) attachment.uploader = uploader - session.saveOrUpdate(attachment) log.info("Updated attachment $id with uploader $uploader") contractClassNames.forEach { contractsCache.invalidate(it) } loadAttachmentContent(id)?.let { attachmentAndContent ->