All Downloads are FREE. Search and download functionalities are using the official Maven repository.

grails.gorm.tests.UniqueConstraintSpec.groovy Maven / Gradle / Ivy

There is a newer version: 9.0.0-M2
Show newest version
package grails.gorm.tests

import grails.persistence.Entity
import org.grails.datastore.mapping.dirty.checking.DirtyCheckable

/**
 * Tests the unique constraint
 */

class UniqueConstraintSpec extends GormDatastoreSpec {

    @Override
    List getDomainClasses() {
        [UniqueGroup, GroupWithin]
    }
}

@Entity
class UniqueGroup implements Serializable, DirtyCheckable {
    Long id
    Long version
    String name
    String desc
    static constraints = {
        name unique:true, index:true
        desc nullable: true
    }
}

@Entity
class GroupWithin implements Serializable {
    Long id
    Long version
    String name
    String org
    static constraints = {
        name unique:"org", index:true
        org index:true
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy