[
http://opensource.atlassian.com/projects/hibernate/browse/HV-427?page=com...
]
Hardy Ferentschik closed HV-427.
--------------------------------
Can't find validator when type is interface type
------------------------------------------------
Key: HV-427
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HV-427
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Affects Versions: 4.2.0.Beta1
Environment: 4.2.0.beta1
Reporter: David J. M. Karlsen
I have a interface TypeA and and implementation of it ConcreteTypeA implements TypeA.
I have created a JSR-303 constraint both for ConcreteTypeA as well as TypeA - and pointed
my constraint to them with @Constraint( validatedBy= ) - but still Hibernate does not find
the validator for it:
javax.validation.UnexpectedTypeException: No validator could be found for type:
com.edb.payment.pays.core.model.account.NorwegianAccountNumber
at
org.hibernate.validator.engine.ConstraintTree.verifyResolveWasUnique(ConstraintTree.java:383)
at
org.hibernate.validator.engine.ConstraintTree.findMatchingValidatorClass(ConstraintTree.java:364)
at
org.hibernate.validator.engine.ConstraintTree.getInitializedValidator(ConstraintTree.java:313)
at
org.hibernate.validator.engine.ConstraintTree.validateConstraints(ConstraintTree.java:144)
at
org.hibernate.validator.engine.ConstraintTree.validateComposingConstraints(ConstraintTree.java:233)
at
org.hibernate.validator.engine.ConstraintTree.validateConstraints(ConstraintTree.java:128)
at
org.hibernate.validator.engine.ConstraintTree.validateConstraints(ConstraintTree.java:117)
at
org.hibernate.validator.metadata.MetaConstraint.validateConstraint(MetaConstraint.java:84)
at
org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:408)
at
org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForRedefinedDefaultGroup(ValidatorImpl.java:341)
at
org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:325)
at
org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:281)
at org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.java:129)
at
com.edb.payment.pays.core.util.validation.constraints.NorwegianAccountNumberValidatorTest.isValid(NorwegianAccountNumberValidatorTest.java:34)
at
com.edb.payment.pays.core.util.validation.constraints.NorwegianAccountNumberValidatorTest.assertValid(NorwegianAccountNumberValidatorTest.java:44)
at
com.edb.payment.pays.core.util.validation.constraints.NorwegianAccountNumberValidatorTest.testAValidAccountNumberWhichHasControlSumZero(NorwegianAccountNumberValidatorTest.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)
at
org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
The same implementation works with Apache Bval:
http://incubator.apache.org/bval/cwiki/downloads.html
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira