From 8a1c327e1fa36a632b449dbd7cbba00878495d1f Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 15 Oct 2015 11:32:59 +0200 Subject: [PATCH] =?utf8?q?No=20caching=20in=20a=20validator,=20else=20it?= =?utf8?q?=20cannot=20be=20updated=20Signed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../addressbook/validator/user/UserIdValidator.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/org/mxchange/addressbook/validator/user/UserIdValidator.java b/src/org/mxchange/addressbook/validator/user/UserIdValidator.java index ae99430..e8836f6 100644 --- a/src/org/mxchange/addressbook/validator/user/UserIdValidator.java +++ b/src/org/mxchange/addressbook/validator/user/UserIdValidator.java @@ -57,10 +57,16 @@ public class UserIdValidator extends BaseLongValidator implements Validator { // Pre-validation (example: not null, not a string, empty string ...) super.preValidate(context, component, value, requiredFileds, false); + // Cast value + Long number = (Long) value; + + // Get status + Boolean ifUserExists = this.userBean.ifUserIdExists(number); + // Is the address book id valid? - if (!this.userBean.ifUserIdExists((Long) value)) { + if (!ifUserExists) { // Is not valid - throw new ValidatorException(new FacesMessage(MessageFormat.format("No user found with id {0}. Please check your link.", value))); //NOI18N + throw new ValidatorException(new FacesMessage(MessageFormat.format("No user found with id {0}. Please check your link.", number))); //NOI18N } // Trace message -- 2.39.5