Consider a Grails domain Class:
class Rate {
static belongsTo = [createdUser:User]
static hasMany=[cancelNo:CancelNo,property:Property ]
Long id
String code
static constraints = {
id ( nullable:true )
code( nullable: true )
}
}
Consider a java Class
class Rate {
Long id
String code
}
I want to remove the domain class and need to reuse the java class
I have done all the mappings in grails-app/conf/hibernate/hibernate.cfg.xml
and created a groovy file RateConstraints.groovy
inside that have given correct package of hibernate java-class and this
constraints = {
id ( nullable:true )
code( nullable: true )
}
what i want to know is, Is it possible to write mapping inside this..? ie,
static belongsTo = [createdUser:User]
static hasMany=[cancelNo:CancelNo,property:Property ]
if it is possible then how it can be achieved..?
否,如果您使用的是Hibernate而不是GORM,则必须使用Hibernate的映射语法,即XML或JPA批注
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.