javax.validation.ConstraintViolationException: validation failed for classes [com.test.Child] during persist time for groups [javax.validation.groups.Default, ]

Spring JIRA | Steve Mosley | 7 years ago
  1. 0

    Executing this script (with changing the db properties where needed) works fine {noformat}// Spring Roo 1.1.0.M1 [rev 3a0b8a3] log opened at 2010-05-21 20:43:39 project --topLevelPackage com.test --projectName Test persistence setup --provider HIBERNATE --database MYSQL entity --class ~.Parent --testAutomatically entity --class ~.Child --testAutomatically field reference --fieldName parent --type com.test.Parent --notNull // Setup the database.properties file for the database perform tests {noformat} That ends up with a test ChildIntegrationTest ... running this through STS 2.3.3 (not via Maven) this test fails with .... {noformat}javax.validation.ConstraintViolationException: validation failed for classes [com.test.Child] during persist time for groups [javax.validation.groups.Default, ] at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.validate(BeanValidationEventListener.java:132) at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.onPreInsert(BeanValidationEventListener.java:71) at org.hibernate.action.EntityIdentityInsertAction.preInsert(EntityIdentityInsertAction.java:159) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:65) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268) {noformat} And I traced this down through debugging .... to in the Parent Data on Demand Aspect {noformat}public Parent ParentDataOnDemand.getRandomParent() { init(); Parent obj = data.get(rnd.nextInt(data.size())); return Parent.findParent(obj.getId()); }{noformat} The get Parent.findParent call is returning null. And this is being called during the ChildDataOnDemand init method which then goes and tries to save the Child with a null parent which causes the validation exception. It also doesn't seem to happen with HyperSonic, I'm using innodb for the tables, and I tried changing the dialect for hibernate to the innodb one but still the same problem.

    Spring JIRA | 7 years ago | Steve Mosley
    javax.validation.ConstraintViolationException: validation failed for classes [com.test.Child] during persist time for groups [javax.validation.groups.Default, ]
  2. 0

    Executing this script (with changing the db properties where needed) works fine {noformat}// Spring Roo 1.1.0.M1 [rev 3a0b8a3] log opened at 2010-05-21 20:43:39 project --topLevelPackage com.test --projectName Test persistence setup --provider HIBERNATE --database MYSQL entity --class ~.Parent --testAutomatically entity --class ~.Child --testAutomatically field reference --fieldName parent --type com.test.Parent --notNull // Setup the database.properties file for the database perform tests {noformat} That ends up with a test ChildIntegrationTest ... running this through STS 2.3.3 (not via Maven) this test fails with .... {noformat}javax.validation.ConstraintViolationException: validation failed for classes [com.test.Child] during persist time for groups [javax.validation.groups.Default, ] at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.validate(BeanValidationEventListener.java:132) at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.onPreInsert(BeanValidationEventListener.java:71) at org.hibernate.action.EntityIdentityInsertAction.preInsert(EntityIdentityInsertAction.java:159) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:65) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268) {noformat} And I traced this down through debugging .... to in the Parent Data on Demand Aspect {noformat}public Parent ParentDataOnDemand.getRandomParent() { init(); Parent obj = data.get(rnd.nextInt(data.size())); return Parent.findParent(obj.getId()); }{noformat} The get Parent.findParent call is returning null. And this is being called during the ChildDataOnDemand init method which then goes and tries to save the Child with a null parent which causes the validation exception. It also doesn't seem to happen with HyperSonic, I'm using innodb for the tables, and I tried changing the dialect for hibernate to the innodb one but still the same problem.

    Spring JIRA | 7 years ago | Steve Mosley
    javax.validation.ConstraintViolationException: validation failed for classes [com.test.Child] during persist time for groups [javax.validation.groups.Default, ]
  3. 0

    Ignore transient pattern on save hibernate entity

    Stack Overflow | 5 years ago | zen0n
    javax.validation.ConstraintViolationException: validation failed for classes [ru.icb.cpaclick.domain.OperatorCheckRequest] during persist time for groups [javax.validation.groups.Default, ]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Upload file fails if file name is longer than XX characters

    GitHub | 3 years ago | nidkhoury
    javax.validation.ConstraintViolationException: validation failed for classes [com.denimgroup.threadfix.data.entities.Document] during persist time for groups [javax.validation.groups.Default, ]
  6. 0

    Problems generating WAF rules

    GitHub | 2 years ago | dancornell
    javax.validation.ConstraintViolationException: validation failed for classes [com.denimgroup.threadfix.data.entities.WafRule] during persist time for groups [javax.validation.groups.Default, ]

    3 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. javax.validation.ConstraintViolationException

      validation failed for classes [com.test.Child] during persist time for groups [javax.validation.groups.Default, ]

      at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.validate()
    2. Hibernate
      BeanValidationEventListener.onPreInsert
      1. org.hibernate.cfg.beanvalidation.BeanValidationEventListener.validate(BeanValidationEventListener.java:132)
      2. org.hibernate.cfg.beanvalidation.BeanValidationEventListener.onPreInsert(BeanValidationEventListener.java:71)
      2 frames
    3. Hibernate
      EntityIdentityInsertAction.execute
      1. org.hibernate.action.EntityIdentityInsertAction.preInsert(EntityIdentityInsertAction.java:159)
      2. org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:65)
      2 frames
    4. Hibernate
      ActionQueue.execute
      1. org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268)
      1 frame