2011-05-10 3 views
0
class Book { 

String name 
String author  
static constraints = { name(nullable:true) 
} 
} 

여러 제약 조건을 가진 웜 엔티티

위의 코드로 ...

위의 코드를 사용하면 ... 원인 : groovy.lang.MissingMethodException : 메소드의 서명이 없습니다. org.codehaus.groovy.grails.validation.ConstrainedPrope rty.call()은 인수 유형에 적용 가능합니다. (org.codehaus.groovy.grails.validation.ConstrainedProperty) 값 : [org.codehau [email protected] [클래스 com.nthdimenzion.domain.Book, 작성자, 클래스 java.lang.String, {nulla ble = org.codehaus.groovy.grails. 가능한 해결책 : wait(), any(), wait (long), 각 (groovy.lang.Closure), any (groovy.lang.Closure), isUrl() 가능한 해결책은 다음과 같습니다. com.nthdimenzion.domain.Book $ _ clinit _closure1.doCall (Book.groovy : 16) at com.nthdimenzion.domain.Book $ _ clinit 6 _closure1.doCall (Book.groovy) ... 23 더 많은

어떤 아이디어?

답변

4

그 ...

static constraints = { 
    name(nullable:true) 
    author(nullabe:false) 
} 

편집

시도 그것이 당신이 원하는 것이라면 라인. (그러나 우리 중 대다수는 oneliners를 사용하지 않는다고 생각합니다 ...)

+0

고마워요. – Sudarshan

관련 문제