Skip to Content
author's profile photo Former Member
Former Member

Pattern Validation Constraint was not working for Integer attribute type

Hi all,

I am trying to apply Pattern constraint to an integer type through adminCockpit validation engine. I have used the ^[0-9]{1,5}$ regex to allow only numbers with in the mentioned range. I have reloaded the validation engine after creating the constraint. But getting an error as "No validator could be found for type: java.lang...", while i try to check the validation result for the specified attribute in Product Cockpit editor area.

Please help me out on this issue. Please find the attached screenshots for reference.

Thanks in advance

Regards, alt text

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 31, 2014 at 08:43 AM

    You could check if the pattern validator works on a string field. If it does it is not applicable for integer and you might need to reimplement it for integer.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Konard, Same I have written my own ConstraintValidator validator with some business logic and it's work for perfectly work for Backoffice but not working for Impex imported from HAC I am using the Hybris 6.6 is there ant idea.

      Thanks in advance...

  • Posted on Nov 16, 2015 at 04:12 PM

    I have very similar Problem. Getting "javax.validation.UnexpectedTypeException: HV000030: No validator could be found for type: java.lang.String."

    The type I want to proofe is a localized String.

     @Target({ TYPE })
     @Constraint(validatedBy = YYYValidator.class)
     public @interface YYYConstraint {
     String message() default "    {...YYYConstraint.message}";
     Class<?>[] groups() default {};
     Class<? extends Payload>[] payload() default {};
     String qualifier();

    And the Validator looks line that:

     public class YYYValidator implements ConstraintValidator<YYYConstraint, ItemModel> {
     private String attribute;
     public void initialize(YYYConstraint yyyConstraint) {
         attribute = yyyConstraint.qualifier();
     public boolean isValid(ItemModel itemModel, ConstraintValidatorContext constraintValidatorContext) {...}

    Where do I have to specify the Type here in my Code??

    Greatings David

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.