Using Hibernate Validator with JPA and Spring

前端 未结 1 591
梦谈多话
梦谈多话 2021-01-15 01:12

I\'m using Hibernate Validator 4.0.2, Spring 3.0 and Hibernate 3.3.2 (which, as I understand it, is pre-JPA2) as a JPA 1 provider.

I\'ve found it easy to integrate t

1条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-15 01:36

    You need to write an entity listener and to trigger validation on @PrePersist, @PreUpdate and even @PreRemove (there are valid use-case for that). See Bean Validation with JPA 1.0 for a code sample.

    0 讨论(0)
提交回复
热议问题