Grails 2.4 RC1 リリース!!
Grails 2.4.0.RC1 リリースです!
やはり、コペンハーゲンで行われる、あのカンファレンスに間に合わせるのか!?
これで問題無ければ次はGAっぽい!
Grails 2.4 内容としては。 ※前回からちょっと更新。
- Spring 4 に更新
- Groovy 2.3 に更新!!!!!
- Groovy 2.3のリリースノートはこちら http://groovy.codehaus.org/Groovy+2.3+release+notes
- もちろん Java 8 対応!
- デフォルトのHibernateが4.3に変更。Hibernate3系もプラグインで提供。
- スタンドアロンGORM
- 静的アセット管理はリソースプラグインから、アセットパイプラインに変更! アセットパイプラインプラグイン
- スタンドアロンGSP - Spring bootでGSPが使えるようになりました。サンプルは以下に。
- @GrailsCompileStaticでのスタティックコンパイル
import grails.compiler.GrailsCompileStatic import groovy.transform.TypeCheckingMode @GrailsCompileStatic class SomeClass { def update() { // this method will be statically compiled } @GrailsCompileStatic(TypeCheckingMode.SKIP) def save() { // this method will not be statically compiled } def delete() { // this method will be statically compiled } }
- Ajaxタグが無くなります - formRemote, remoteField, remoteFunction, remoteLinkなどのAJAXタグが将来のバージョンで無くなります。
- grails-debugとgrails-debug.batが削除されました。 - 今後はgrails -debugか、grails --debug-forkで実行しましょう。
- コマンドオブジェクトでの nullable:false 対応
- コマンドオブジェクトデータバインダーで同じドメインで複数引数が可能に。
- 以下のように、Personが複数指定されている場合に、リクエストパラメータを、buyer.nameやseller.name等の指定をすると、それぞれのオブジェクトにバインドされます。
class StoreController { def buy(Person buyer, Person seller) { // … } } class Person { String name }
- GORMで、よりアドバンスドなサブクエリー
- サブクエリーが拡張されました。ネストサブクエリで"in"が使用できます。
def results = Person.where { firstName in where { age < 18 }.firstName }.list()
-
- Criteriaとwhereクエリがシームレスに融合できます
def results = Person.withCriteria { notIn "firstName", Person.where { age < 18 }.firstName }
-
- サブクエリでプロジェクションを一緒に使用できます。
def results = Person.where { age > where { age > 18 }.avg('age') }
-
- 2つのドメインクラスに別れた関連するクエリ実行:
def employees = Employee.where { region.continent in ['APAC', "EMEA"] }.id() def results = Sale.where { employee in employees && total > 100000 }.employee.list()
-
- whereクエリでの簡単な変数宣言を使用したエイリアス(クロスクエリリファレンス)のサポート。
def query = Employee.where { def em1 = Employee exists Sale.where { def s1 = Sale def em2 = employee return em2.id == em1.id }.id() } def results = query.list()
- ネームスペース付きのコントローラでのビューの選択 - 新たにネームスペース付きコントローラ用のビューディレクトリが選択されるようになりました。
namespace指定があるコントローラのビューファイルは、grails-app/views/
class SomeController { static namespace = 'foo' def myaction(){ //この場合は、 grails-app/views/foo/some/myaction.gspが最初に参照され //存在しない場合は grails-app/views/some/myaction.gsp が参照されます。 [number:1] } }
// org.springframework.transaction.support.DefaultTransactionDefinition のプロパティに対応したMapキーで指定 Account.withTransaction([propagationBehavior: TransactionDefinition.PROPAGATION_REQUIRES_NEW, isolationLevel: TransactionDefinition.ISOLATION_REPEATABLE_READ]) { // ... }
- Grails 2.3からの更新注意点。(公式ドキュメント英語版※正式リリースまでには翻訳します)
まだ翻訳途中ですが公式意訳ドキュメントの"Grails 2.4の新機能"を確認してください。
http://grails.jp/doc/2.4.0.M1/guide/introduction.html#whatsNew24 ※なるべく早く更新しますー。
近々2.4の他のドキュメントも確認して公開します。それまでは、本家で!
http://grails.org/doc/2.4.0.RC1/
Grails 2.4.0.RC1の公式リリースノートはこちら。
http://grails.org/2.4.0.RC1+Release+Notes
JIRA http://jira.grails.org/secure/ReleaseNote.jspa?projectId=10020&version=13705
ダウンロード http://grails.org/Download ※セレクタで2.4を選んでね
直リン grails-2.4.0.RC1.zip
ドキュメント http://grails.org/doc/2.4.0.RC1