Archive for the ‘Groovy’ Category

While playing with Groovy and Db4o I ran across a few errors that nearly put me right off Db4o. But after half a day tinkering I have found that it’s not really a problem with Db4o. If you are getting any of the following errors when trying to use Db4o and Groovy then perhaps this post can help.

Errors:

java.lang.ClassCastException
cannot be cast to com.db4o.reflect.generic.GenericObject // or person.getClass() is this.
// When trying to access a method or property of a retrieved object.
groovy.lang.MissingMethodException
groovy.lang.MissingPropertyException
(G) Person // GenericObject, e.g: println person

Continue reading ‘Groovy scritps and Db4o’ »

I’m not sure if I just like HQL (Hibernate Query Language) because it is so close to SQL or because I don’t get the otherwise fabulous Grails HibernateCriteriaBuilder well enough to be sure of some of the more tricky queries. I do enjoy using the criteria builder but seem to hit limitations every so often, perhaps it is just that the type of queries that I happen to be writing lend themselves well to HQL.

Continue reading ‘Groovy HqlBuilder’ »

One of the things that Groovy is really great at is creating Domain Specific Languages (DSL) or Builders.

Continue reading ‘Groovy class contructor with closure’ »

Thanks to the awesome groovy-ness of groovy this is crazy easy!
Continue reading ‘Render a log or text file with Grails’ »

It is well advised to place application and business logic in service classes when doing any programming and indeed the Grails user guide does advise this. However the default templates do not do this so there is no example or dare I say it best practice example that I could find on the web. So exactly how do we get the controller and service to interact and retain all the functionality provided by the templates and generate-all?

Continue reading ‘Grails Service And Controller Interface’ »