如何在Grails中创建Domain类实例?

时间:2012-01-17 06:10:58

标签: grails

我在grails中有两个Domain类

class Quotation {

    static searchable =true
    static constraints = {
        referenceNo(nullable:true)
        dateOfRequest(validator: {return (it <= new Date())})
        number(blank:false)
        estimatedHours(nullable:true, blank:false, min:0)
    }

    int referenceNo;
    Date dateOfRequest;
    String number="11-120001Q01";

    int estimatedHours; 
    String toString(){
        return number   
    }   
}


class Project {

    static constraints = {
        projectID(blank:false,nullable:false)
        number(blank:true,nullable:true)
        projectManager(blank:false)
        teamLeader(blank:false)
        teamMembers(blank:false)
        sizeOfTeam(blank:false)
        status(inList:["active", "closed"])
    }

    String projectID
    Quotation number
    String projectManager
    String teamLeader
    String teamMembers
    Integer sizeOfTeam
    String status
}

我想将Quotation类中的number和estimatedHours打印到Project类中,但它只显示number.Can任何一个请告诉我如何在Project类中创建一个Quotation实例并调用引号的getter和setter方法类?

0 个答案:

没有答案