Skip to Content
Former Member
Jan 17, 2018 at 05:37 PM

Problem creating custom constraint in backoffice


Dear hybris experts, I have a problem with creating a custom constraint in the backoffice. I have used the steps exactly described in

but when I try to make a build I am getting a compilation error in that

   [yjavac] 1. ERROR in /.../hybris/bin/custom/companynamebackoffice/gensrc/companynamebackoffice/ (at line 131)
    [yjavac]     de.companyname.pim.backoffice.validation.annotations.AdvantagesNoDuplicates.class,
    [yjavac]     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [yjavac] de.companyname.pim.backoffice.validation.annotations cannot be resolved to a type
    [yjavac] ----------
    [yjavac] 1 problem (1 error)

Here is the itemtype that I have

  <itemtype code="AdvantagesNoDuplicatesConstraint" autocreate="true" generate="true" extends="AttributeConstraint"
                     <description>Custom constraint to validate that no duplicate advantages are selected for the product</description>
                         <attribute qualifier="annotation" type="java.lang.Class" redeclare="true">
                             <modifiers write="false" initial="true" />


And this is the annotation

         validatedBy = {AdvantagesNoDuplicatesValidator.class}
 public @interface AdvantagesNoDuplicates {
     String message() default "{de.companyname.pim.backoffice.validation.annotations.AdvantagesNoDuplicates.message}";
     Class<?>[] groups() default {};
     Class<? extends Payload>[] payload() default {};

Have some had such kind of problems as well ?

Thanks and Kind Regards,