Blogs

SpringSource Blog

Introducing GORM for Gemfire

grocher

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:

GORM for Gemfire Screencast

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

Share this Post
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • DZone
  • LinkedIn
  • Slashdot
  • Technorati
  • Twitter
 

4 responses


  1. Excellent job. Works very well !
    Do you have any example of cache.xml with persistence enabled ?
    I tried to change data-policy value without success …


  2. @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


  3. @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"


  4. @grocher
    I also find an exemple in Gemfire examples
    http://community.gemstone.com/display/gemfire/Setting Up the Product Examples
    Thanks a lot !

4 trackbacks

Leave a Reply