Grails 1.1 베타 1 출시, 향상된 테스트, Gorm, 비계 및 플러그인 시스템

GORM
 
더 나은 GORM 이벤트
GORM은 Before Insert, Before Update, Before Delete 이벤트를 지원합니다. 현재 애프터 Insert, 애프터 Update, 애프터 Delete 이벤트에 대한 지원이 추가되었습니다.
기본 유형 집합을 지원하는 저장소
GORM은 String, Integer 같은 기본 유형의 집합 저장소를 지원하기 위해 join table을 사용합니다.
class Person {
   static  hasMany = [nicknames:String]
}
 
 
데이터 바인딩 기능 향상
지금은 속성의 자신과 데이터에 대한 귀속이 더욱 쉽다.이전 릴리즈에서는 다음을 사용할 수 있습니다.
person.properties = params
 
이것은 Request의 모든 변수를 개인에 연결합니다.모든 데이터를 연결하고 싶지 않으면bindData 방법을 사용할 수 있습니다.이제 subscript operator를 사용하여 해당 부분의 변수를 바인딩할 수 있습니다.
person.properties["firstName","lastName"] = params
 
domain의 모든 속성의 하위 집합을 가져오려면 다음과 같이 하십시오.
person.properties["firstName","lastName"].each { println it }
  
 
읽기 전용으로 객체 가져오기
이제 read 방법을 사용하여 읽기 전용 객체를 가져올 수 있습니다(변경, 삭제 불가).
 
def book = Book.read(1)
 
 
기본 정렬
현재 domain에서sort를 설명하는 방식으로 관련 대상의 정렬 방식을 지정할 수 있습니다.
class Book {
  String

  title
  
  static
 mapping = {
     sort "title"

  }
}
 
연관에서sort를 선언할 수도 있습니다.
class Author {
    static

    
    hasMany = [books:Book]
    
    static
 mapping = {
              books sort:"title"

    }
}
 
 
Batch Fetching
GORM은 이제 domain에서 DSL을 사용하여 batch fetching(an optimization of lazy loading)을 구성할 수 있습니다.
class Book {
  String

  title
  
  static
 mapping = {
     batchSize 15
  }
}
 
또한 연관에서 사용할 수 있습니다.
class Author {
    static



 hasMany = [books:Book]
    static



 mapping = {
              books batchSize:15
    }
}
 
 
향상된 동적 검색기
InList에 대한 동적 탐색기 신규 지원:
def groovyBooks = Book.findByAuthorInList(['Dierk Koenig', 'Graeme Rocher'])
 
동적 검색기는query cache:
def books = Book.findByTitle("Groovy in Action", [cache:true] )
 
비관 잠금(pessimistic lock):
def books = Book.findByTitle("Groovy in Action", [lock:true] )
 
 
남겨진 데이터베이스의 단방향 일대다 관계를 처리하다
단방향 일대다 관계식은joinTable 속성을 통해 타고 있는 데이터베이스에서 매핑하는 방식을 변경할 수 있습니다.
class Book {
 String

 title

 static
 belongsTo = Author
 static
 hasMany = [authors:Author]

static mapping = { authors joinTable:[name:"mm_author_books" , key:'mm_book_id' ] } } class Author { String name



 static hasMany = [books:Book] static mapping = { books joinTable:[name:"mm_author_books" , key:'mm_author_id'] } }

 
 
 
 
플러그 인
 
전역 플러그인
모든 grails 프로그램에서 사용할 수 있도록 전역 플러그인 설치가 지원됩니다.
grails install-plugin webtest -global

 
여러 플러그인 소스 지원(Repository)
Grails는 현재 USER를 통해HOME/.grails/settings.groovy 파일이나grails-app/conf/BuildSettings.groovy 파일은 여러 개의 플러그인 원본을 설정합니다. 상기 파일은 해당하는 정보를 포함해야 합니다.
grails.plugin.repos.discovery.myRepository="http://svn.codehaus.org/grails/trunk/grails-test-plugin-repo"
grails.plugin.repos.distribution.myRepository="https://svn.codehaus.org/grails/trunk/grails-test-plugin-repo"



 
 
Automatic Transitive Plugin Resolution
이제 플러그인을 SVN에 넣을 필요가 없습니다.Grails 프로그램이 처음 불러올 때 플러그인의 메타데이터를 통해 자동으로 설치됩니다.플러그인 의존도 문제도 해결됐다.
 
테스트
 
새로운 테스트 프레임워크
1.0.x의 버전에서 플러그인으로 나온 테스트 프레임워크 (test framework 가 현재Grails에 통합되었습니다.
 
 
 
비계
 
템플릿 및 동적 비계
 
동적 비계는 현재 템플릿을 사용할 수 있으며 install-templates 관련 템플릿을 통과할 수 있다
 
 
 
 
추가 관련 자료:
Changelog: http://jira.codehaus.org/browse/GRAILS?report=com.atlassian.jira.plugin.system.project:changelog-panel Download: http://grails.org/Download Documentation: http://grails.org/doc/1.1

좋은 웹페이지 즐겨찾기