hibernate validator - different groups on create, update, delete

℡╲_俬逩灬. 提交于 2019-12-01 19:44:56

You're probably looking for "Hibernate event-based validation" under "ORM Integration". You can set properties to specify which groups to validate at different times by setting properties on the SessionFactory like so:

<property name="javax.persistence.validation.group.pre-persist">javax.validation.Default</property>
<property name="javax.persistence.validation.group.pre-update">javax.validation.Default</property>
<property name="javax.persistence.validation.group.pre-remove"></property>

The above is the default configuration if you don't specify anything. Specifically, the javax.validation.Default group is validated on creates and updates. Nothing is validated on deletes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!