org.grails.core.exceptions.GrailsRuntimeException: Target of [unique] constraints [composite.id.unique.UniqueWithCompositeId : (unsaved)] is not a domain instance. Unique constraint can only be applied to domain classes and not custom user types or embedded instances

GitHub | sascharitter | 5 months ago
  1. 0

    Domain class fails to save when defining a composite ID and a multi-column unique constraint

    GitHub | 5 months ago | sascharitter
    org.grails.core.exceptions.GrailsRuntimeException: Target of [unique] constraints [composite.id.unique.UniqueWithCompositeId : (unsaved)] is not a domain instance. Unique constraint can only be applied to domain classes and not custom user types or embedded instances
  2. 0

    Grails 3.1 - FileWatcher caught serious error, see cause

    GitHub | 9 months ago | Omnipresent
    org.grails.core.exceptions.GrailsRuntimeException: Error instantiated artefact class [class try3.api.HelloController] of type [class org.grails.core.DefaultGrailsControllerClass]: InvocationTargetException

    Root Cause Analysis

    1. org.grails.core.exceptions.GrailsRuntimeException

      Target of [unique] constraints [composite.id.unique.UniqueWithCompositeId : (unsaved)] is not a domain instance. Unique constraint can only be applied to domain classes and not custom user types or embedded instances

      at org.grails.orm.hibernate.validation.UniqueConstraint.processValidate()
    2. Grails GORM
      UniqueConstraint.processValidate
      1. org.grails.orm.hibernate.validation.UniqueConstraint.processValidate(UniqueConstraint.java:142)
      1 frame
    3. Grails
      GrailsDomainClassValidator.validate
      1. grails.validation.AbstractConstraint.validate(AbstractConstraint.java:107)
      2. grails.validation.ConstrainedProperty.validate(ConstrainedProperty.java:979)
      3. org.grails.validation.GrailsDomainClassValidator.validatePropertyWithConstraint(GrailsDomainClassValidator.java:211)
      4. org.grails.validation.GrailsDomainClassValidator.validate(GrailsDomainClassValidator.java:81)
      4 frames
    4. Grails GORM
      AbstractHibernateGormInstanceApi.save
      1. org.grails.orm.hibernate.AbstractHibernateGormInstanceApi.save(AbstractHibernateGormInstanceApi.groovy:122)
      1 frame
    5. Grails GORM
      GormEntity$Trait$Helper.save
      1. org.grails.datastore.gorm.GormEntity$Trait$Helper.save(GormEntity.groovy:151)
      1 frame