From 84b22e9b949fd06e03b8ba67a1a7599aa9f88328 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Mon, 3 Nov 2025 08:02:14 +0100 Subject: [PATCH] =?UTF-8?q?bugfix:=20it=20was=20not=20possible=20to=20crea?= =?UTF-8?q?te=20new=20locations=20on=20the=20top=20level=20=E2=80=93=20thi?= =?UTF-8?q?s=20is=20now=20fixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stephan Richter --- .../src/main/java/de/srsoftware/umbrella/stock/SqliteDb.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stock/src/main/java/de/srsoftware/umbrella/stock/SqliteDb.java b/stock/src/main/java/de/srsoftware/umbrella/stock/SqliteDb.java index 08e8860..2ffcaa2 100644 --- a/stock/src/main/java/de/srsoftware/umbrella/stock/SqliteDb.java +++ b/stock/src/main/java/de/srsoftware/umbrella/stock/SqliteDb.java @@ -1,6 +1,7 @@ /* © SRSoftware 2025 */ package de.srsoftware.umbrella.stock; +import static de.srsoftware.tools.Optionals.is0; import static de.srsoftware.tools.Optionals.nullIfEmpty; import static de.srsoftware.tools.jdbc.Condition.equal; import static de.srsoftware.tools.jdbc.Condition.isNull; @@ -302,11 +303,11 @@ public class SqliteDb extends BaseDb implements StockDb { @Override public DbLocation save(DbLocation location) { - var parentId = location.parent() == 0 ? null : location.parent(); + var parentId = is0(location.parent()) ? null : location.parent(); if (location.id() == 0) { // new location try { var rs = insertInto(TABLE_LOCATIONS,OWNER,PARENT_LOCATION_ID,NAME,DESCRIPTION) - .values(location.owner().dbCode(),location.parent() == 0 ? null : parentId,location.name(),location.description()) + .values(location.owner().dbCode(),parentId,location.name(),location.description()) .execute(db).getGeneratedKeys(); long id = 0; if (rs.next()) id = rs.getLong(1);