SpringOne 2GX - Grails 2 Update
Presenter: Jeff Brown8:30am 10/17/2012
Grails shell
The grails shell is the new preferred way to use grails (overcomes JVM startup time).Better Unit Test results HTML output.
Documentation engine that is bundled with Grails is available to grails apps (and externally). "grails doc" to generate documentation.
Default database now H2
Grails also now includes a database console app (http://localhost:8080/app/dbconsole) (available in development only!). The console app works for other relational databases too.Upgrades to underlying software
As part of Grails 2 underlying software (tomcat, Spring, groovy, etc.) were upgraded.New automatic reloading is much better than in Grails 1.x
Controller actions are now declared as public methods:
// some controller ...form parameters are automatically bound to method arguments. (e.g., .../foo/save?name=Dan&age=10)
def save(String name, int age) {
...
}
To convert a parameter to a date use:
def myDate = params.date('myDate', 'dd-MM-yyyy')
HTML5 scaffolding
Scaffolding updated to use HTML5. grails install-templates will make the templates available to be viewed/modified.New Page Rendering API available.
One application of this would be to create an email body using a gsp templateNew Link Generator API available.
"grails install-plugin foo" is deprecated. Should modify BuildConfig.groovy to explicitly list the dependency on the plugin.jQuery is the default javascript framework in Grails 2.
GORM can now use other underlying persistence mechanisms
Grails Object-Relational Mapping (GORM) now does not have to use Hibernate as the underlying mechanism (other mechanisms include: mongoDB, Cassandra, redis, riak, neo4j)Where queries
def query = Person.where { age < 20 }The where method accepts a closure that defines the "where" clause in ordinary groovy syntax (not SQL...). The closure is translated into SQL behind the scenes (using an AST transformation).
def people = query.list(params)
def cnt = query.count()
0 Comments:
Post a Comment
<< Home