Use of GORM methods in Integration test
        Posted  
        
            by 
                canotto90
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by canotto90
        
        
        
        Published on 2012-11-19T22:55:19Z
        Indexed on 
            2012/11/19
            22:59 UTC
        
        
        Read the original article
        Hit count: 336
        
I'm trying to use gorm find method on my domain class, inside of an Spock Integration Spec.
My code:
class myDomainClassSpec extends IntegrationSpec{
    ...
    def 'my test'() {
        when: ...
        then:
            MyDomainClass.find { id == 1 }
    }
    ...
}
This fails, throwing:
groovy.lang.MissingPropertyException: No such property: id for class: grails.gorm.DetachedCriteria
If instead I code: MyDomainClass.findAll().find { id == 1 } it works.
Any ideas??
© Stack Overflow or respective owner