JPA 2.0 : Exception to use javax.validation.* package in JPA 2.0

前端 未结 2 1387
感情败类
感情败类 2020-11-27 18:57

when i try to using bean validation with JPA using hibernate , the follwoing exception will occur :

Exception in thread \"main\" javax.persistence.Persistenc         


        
2条回答
  •  萌比男神i
    2020-11-27 19:17

    As @Korgen mentioned in comments hibernate-validator-5.x.x isn't compatible with validation-api-1.0.x. This is because of moving to new specification JSR-303 -> JSR-349.

    There are two ways to solve this issue:

    1. Downgrade hibernate validator version (which is implements JSR-303):

    
        org.hibernate
        hibernate-validator
        4.3.1.Final
     
    

    2. If you don't want to move back from hibernate validator 5 to hibernate validator 4 another solution is to upgrade javax.validation to higher version (which is describe JSR-349):

    
        javax.validation
        validation-api
        1.1.0.Final
    
    

提交回复
热议问题