Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble with gwt validation

Tags:

validation

gwt

I am trying to use gwt valiation module (jsr303) using new validation-api (1.1) and Hibernate validator (5.0), but, obvious got

ERROR: Errors in 'file:/C:/projects/qiwi-digest/webui/trunk/src/main/java/ru/befree/qiwi/client/gin/SampleValidatorFactory.java'
  ERROR: Line 27: No source code is available for type javax.validation.ParameterNameProvider; did you forget to inherit a required module?
  ERROR: Line 27: The method getParameterNameProvider() of type SampleValidatorFactory must override or implement a supertype method
  ERROR: Line 28: No source code is available for type org.hibernate.validator.internal.engine.DefaultParameterNameProvider; did you forget to inherit a required module?
  ERROR: Line 32: The method close() of type SampleValidatorFactory must override or implement a supertype method

I.e. GWT currently doesn't have Validation API 1.1 support.

Any ideas of workaround?

like image 750
user2235513 Avatar asked May 02 '26 08:05

user2235513


1 Answers

You are probably ahead of the curve in using Hibernate 5!!!!

GWT supports only upto hibernate 4.1.0.Final . Here is the snipped of maven pom.xml from GWT sample for Validation.

   <!-- Hibernate bean validation binary for the server -->

    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-validator</artifactId>
      <version>4.1.0.Final</version>
      <exclusions>
        <exclusion>
          <groupId>javax.xml.bind</groupId>
          <artifactId>jaxb-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.sun.xml.bind</groupId>
          <artifactId>jaxb-impl</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- Hibernate bean validation source for the GWT client -->

    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-validator</artifactId>
      <version>4.1.0.Final</version>
      <classifier>sources</classifier>
      <exclusions>
        <exclusion>
          <groupId>javax.xml.bind</groupId>
          <artifactId>jaxb-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.sun.xml.bind</groupId>
          <artifactId>jaxb-impl</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

GWT has ported hibernate validator code to work with client side. You can find it here - https://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/org/hibernate/validator

You can try hacking around this to support hibernate 5 and validation-api 1.1 !!!

like image 169
appbootup Avatar answered May 05 '26 20:05

appbootup



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!