Grails is an open source Java framework for creating web applications. Support of Groovy adds productive and simplicity, whereas support ...
Grails is an open source Java framework for creating web applications. Support of Groovy adds productive and simplicity, whereas support of direct Java language extends feather. This framework is inspired by Ruby on Rails into the Java world such as DRY (Don’t Repeat Yourself) and Convention over Configuration (COC)
Groovy is simple yet powerful scripting language that is targeted to the JVM and features a mix of static and dynamic typing. Groovy scripts are compiled to Java classes and can import regular Java classes (and vice-versa), so we can take advantage of your existing libraries.
Grails is lot like a Rails framework. GORM (Grails Object Relational Mapping) is used to map domain objects to their corresponding database table. Under the hood, GORM using Hibernate. GORM objects look and act very much like ActiveRecord objects of Rails. Grails is targeted at Java developers (a very large community indeed).
Few advantages of Grails framework:
- Grails is built on several popular frameworks (such as SiteMesh, Hibernate, Spring).
- Java programmers will have a flat learn curve, especially for those familiar with Hibernate and Spring.
- Grails is maintained by SpringSource.com, that means the flexibility and scalability
- Grails application can be deployed on many popular J2EE servers, such as JBoss, Tomcat, WebLogic etc.
- Direct support of two(2) language extends choice in some use-cases.
Let's talk about some performance tricks.
This is very powerful way to check duplicate keys in any DBMS, but it has some impact on application performance. It try to issue multiple query in DBMS. If you are lucky to use PostgreSql use unique index.
Optimize your JVM param:
Default configuration comes with limited heap size.
The @CompileStatic annotation can be added to individual methods as well as to entire classes. So we have choice of using this when appropriate.
Bulk inset or data-feed import
In case of bulk insert, use programatic transaction after list of data are inserted: Follow the example below:
for ( i in 1..1000000 )
// add your logic....
def session = sessionFactory.currentSession
Update grails version to latest stable edition:
You will get some improvement with no line of code.
Disable the second level cache of Hibernate for enterprise application.
Auto-flush can be set to true for fast prototyping. Disabling the auto-flush to false to control transaction efficiently for enterprise project.
Recheck and Disable Unused Plugins