Ignore transient pattern on save hibernate entity

前端 未结 2 1660
鱼传尺愫
鱼传尺愫 2021-01-15 02:53

How to save hibernate entity and ignore (not correct)transient pattern.

for example:

@Entity
@Table(name=\"`REQUEST`\")
@Inheritance(strategy=Inherit         


        
相关标签:
2条回答
  • 2021-01-15 03:22

    You should use the groups feature of hibernate validator and assign a different group to the validation constraints specified on the transient field.

    If you want those constraints enabled you need to specifically mention the group. By default when hibernate tries to save the entity it will check all the validations as part of the default group.

    0 讨论(0)
  • 2021-01-15 03:44

    See http://docs.jboss.org/hibernate/validator/4.2/reference/en-US/html_single/#validator-checkconstraints-orm. By default, Hibernate (the ORM) checks every constraint of the default validation group. So you might put this particular constraint into another group.

    See http://docs.jboss.org/hibernate/validator/4.2/reference/en-US/html_single/#validator-usingvalidator-validationgroups for explanations on validation groups.

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