버전 1.2에서 Grails는 전역 제약 조건을 도입했습니다. 나는 내가 널 전자 메일 주소를 가진 사용자를 저장하지만, 오류가보고되지 내 도메인 클래스 static constraints = {
email(email: true, unique: true, shared: 'notBlank')
}
을 중 하나를 사용하여 다음 grails.gorm.
가 나는 다음과 같은 일대 다 관계가 있다고 가정하자 일대 기준 빌더와 : Site has many Users
User belongs to one Site
나는했습니다 설정이 class Site {
static hasMany = [users:User]
...
}
같은 관계를 및 class User {
static bel
나는 Grails를 1.1.2에서 두 개의 도메인 클래스를 다음과 같은 한 : 나는 B 인스턴스의 myField을 설정하면 class A implements Serializable {
MyEnumType myField
Date fieldChanged
void setMyField(MyEnumType val) {
if (myField != nu
내가 ShopCategoryPageTab이라는 도메인 클래스가 있다고 가정 해 봅시다. Product라는 도메인 클래스가 있습니다. ShopCategoryPageTab에 제품 목록이 필요합니다. 그러나이 목록은 정적이 아니고 수식에 의해 결정됩니다. 예를 들어, 내가 기준 X와 함께 모든 제품을 나열 것 "제품"속성, Y Z. 그래서이 속성/목록에 사람이
select
b.security_type,
b.symbol,
b.security_description,
b.trade_date_qty as 'axys_qty',
c.trade_date_qty as 'fidelity_qty',
c.trade_date_qty - b.trade_date_qty as
the Grails GORM guide에 따르면 tablePerHierarchy가 false로 설정되어 있지 않으면 도메인 클래스의 하위 클래스가 부모 클래스와 동일한 테이블을 공유합니다. 나는 다음과 같은 매핑 문이 때문에 "추상적"키워드 내 데이터베이스가 어떤 항목 테이블을 포함하지 abstract class Item implements Comparab
지도가있는 간단한 도메인 클래스를 만들었습니다. class Foo {
Map bar
}
바 매핑 STH 등이 생성됩니다 :이 create table foo_bar (bar bigint, bar_idx varchar(255),
bar_elt varchar(255) not null);
... http://www.grails.org/G