2014-06-10 4 views
2

는 Grails의 도메인 클래스를 고려 절전 클래스와 GORM 교체 :Grails는 :

class Rate { 
    static belongsTo = [createdUser:User]  
    static hasMany=[cancelNo:CancelNo,property:Property ] 
    Long id 
    String code 
    static constraints = { 
     id (nullable:true) 
     code(nullable: true) 
    } 
} 

는 자바 클래스를 고려

class Rate {    
    Long id 
    String code  
} 

내가 도메인 클래스를 제거 할 및 자바 클래스를 재사용 할 필요가

나는 모든 매핑을 완료했습니다. grails-app/conf/hibernate/hibernate.cfg.xml

그리고 gr oovy RateConstraints.groovy 최대 절전 모드 자바 클래스의 올바른 패키지를 준 내부 파일이

constraints = { 
    id (nullable:true) 
    code(nullable: true) 
} 

, 그것은이 내부에서 매핑을 작성할 수 내가 알고 싶은이다 ..? 예 :

static belongsTo = [createdUser:User]  
static hasMany=[cancelNo:CancelNo,property:Property ] 

가능한 경우 어떻게 달성 할 수 있습니까?

답변

0

아니 당신이 XML 또는 JPA 주석 중 하나 인 Hibernate의 매핑 구문을 사용할 필요가 대신 GORM의 최대 절전 모드를 사용하는 경우

+0

.. –

+0

trasients에게 제공 할 수있는 간단한 예제를 줘 같은이 과도 = [ ' startDate ','endDate '] RateConstraints.groovy에서 –