summaryrefslogtreecommitdiffstats
path: root/cps-ri/src/main
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2023-08-17 15:43:34 +0100
committerDaniel Hanrahan <daniel.hanrahan@est.tech>2023-08-17 15:17:15 +0000
commit996d0c2b23a70e62853632f0b644b3fe4d212143 (patch)
treeb9f1dfb76dcae12074cf5fd42a553189af6f651b /cps-ri/src/main
parenta52b1825f99318181cd356dcde1b1db46c1098ac (diff)
Update of top-level data node fails with SQL error
The error is caused by the fetch-descendants code using ResultSet.getLong which returns a 'long' primitive instead of a 'Long' object. Thus a parent ID of 'NULL' becomes '0', which causes an error during update. To preserve the NULL value, ResultSet.getObject must be used. Issue-ID: CPS-1841 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: Ida6837a04954cd3c23f0f2faabd7d0712d8ee19d
Diffstat (limited to 'cps-ri/src/main')
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepositoryImpl.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepositoryImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepositoryImpl.java
index 4f056c8f6e..c187f20ea9 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepositoryImpl.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepositoryImpl.java
@@ -94,7 +94,7 @@ public class FragmentPrefetchRepositoryImpl implements FragmentPrefetchRepositor
final FragmentEntity fragmentEntity = new FragmentEntity();
fragmentEntity.setId(resultSet.getLong("id"));
fragmentEntity.setXpath(resultSet.getString("xpath"));
- fragmentEntity.setParentId(resultSet.getLong("parentId"));
+ fragmentEntity.setParentId(resultSet.getObject("parentId", Long.class));
fragmentEntity.setAttributes(resultSet.getString("attributes"));
fragmentEntity.setAnchor(anchorEntityPerId.get(resultSet.getLong("anchorId")));
fragmentEntity.setChildFragments(new HashSet<>());