# HG changeset patch # User Tom Gottfried # Date 1486046465 -3600 # Node ID 15700d7c00eba15474a420de2d4b0b897a798c88 # Parent efa50b39c7cc29deb5f5e7782b1fdd96db798c47 According to database schema, ort.ort_typ is allowed to be NULL. diff -r efa50b39c7cc -r 15700d7c00eb src/main/java/de/intevation/lada/validation/rules/ort/OrtTypExists.java --- a/src/main/java/de/intevation/lada/validation/rules/ort/OrtTypExists.java Thu Feb 02 15:01:12 2017 +0100 +++ b/src/main/java/de/intevation/lada/validation/rules/ort/OrtTypExists.java Thu Feb 02 15:41:05 2017 +0100 @@ -37,17 +37,19 @@ public Violation execute(Object object) { Ort ort = (Ort)object; - QueryBuilder builder = - new QueryBuilder( - repository.entityManager("stamm"), - OrtTyp.class); - builder.and("id", ort.getOrtTyp()); - List ots = repository.filterPlain( - builder.getQuery(), "stamm"); - if (ots == null || ots.isEmpty()) { - Violation violation = new Violation(); - violation.addError("ortTyp", 612); - return violation; + if (ort.getOrtTyp() != null) { + QueryBuilder builder = + new QueryBuilder( + repository.entityManager("stamm"), + OrtTyp.class); + builder.and("id", ort.getOrtTyp()); + List ots = repository.filterPlain( + builder.getQuery(), "stamm"); + if (ots == null || ots.isEmpty()) { + Violation violation = new Violation(); + violation.addError("ortTyp", 612); + return violation; + } } return null;