Introducing GORM for Gemfire |
|

One of the many reasons for the rise of NoSQL datastores is the need to scale applications beyond their traditional comfort zone in the relational world. The irony is that Gemfire has been doing exactly this long before the term NoSQL was even coined by providing scale to some of the largest financial organizations in the world.
Gemfire is far more than a cache, but a complete data fabric with support for Grid Computing, Map/Reduce, continuous queries and transactional write-behind.
For those of you who attended the keynote at the hugely successful SpringOne2GX conference this may be old news. For the rest today I am pleased to announce the availability of the GORM for Gemfire plugin for Grails.
Just like GORM for Redis, the Gemfire plugin lets you use great GORM features like dynamic finders, criteria queries and named queries on top of the Gemfire distributed data fabric. GORM for Gemfire translates your queries into Gemfire's Object Query Language (OQL.).
Beyond supporting dynamic finders the plugin also supports a rich API for executing continuous queries using a special "cq" namespace and closures:
Person.cq.findAllByLastName("Flintstone") { event ->
if(!event.throwable) {
println "NEW FLINSTONE ${event.newValue.firstName}"
}
}
The plugin also allows closures to be executed as Gemfire functions that are serialized across your partitioned Gemfire regions and executed where the data lives allowing commons patterns such as Map/Reduce:
def results = Plant.executeFunction([p.id]) { ctx ->
ctx.lastResult ctx.localData[ctx.filter.iterator().next()]
}
assert results[0].name == 'cabbage'
We have prepared an introductory video for those who want to get up to speed with using GORM for Gemfire within a Grails application:
Further information on how to get started can be found in the Gemfire plugin's user guide and official Gemfire developer documentation. Enjoy!
Similar Posts
- Yet Another Flavour of GORM: MongoDB
- Announcing GORM for Redis
- VMware vFabric GemFire 6.5: modern data management for modern applications
- Countdown to Grails 2.0: Persistence
- GORM Gotchas (Part 3)





Sly says:
Added on October 28th, 2010 at 4:52 pmExcellent job. Works very well !
Do you have any example of cache.xml with persistence enabled ?
I tried to change data-policy value without success …
grocher (blog author) says:
Added on October 29th, 2010 at 3:36 am@Sly
Each domain class is mapped to a Gemfire region, you can configure how the region is mapped using the static mapping block inside each domain:
static mapping = {
dataPolicy DataPolicy.REPLICATE
}
This will allow you to change the data policy, you can then regenerate the cache.xml if you plan to use a Gemfire server instance. See the section on mapping entities to regions in the user guide:
http://grails-plugins.github.com/grails-gemfire/docs/manual/guide/4. GORM for Gemfire.html#4.3 Mapping Entities to Regions
grocher (blog author) says:
Added on October 29th, 2010 at 3:37 am@Sly that link didn't work out too well. Go to
http://grails-plugins.github.com/grails-gemfire/docs/manual/
And see section "4.3 Mapping Entities to Regions"
Sly says:
Added on October 29th, 2010 at 11:03 am@grocher
I also find an exemple in Gemfire examples
http://community.gemstone.com/display/gemfire/Setting Up the Product Examples
Thanks a lot !