March 2010
4 posts
3 tags
Grails portlets : eager fetching in service class
Developing portlets with Grails is great but there are still some issue to solve. Today I would talk about two problems related to GORM and Hibernate. First: some GORM stuff works, while some others don’t and cause exceptions about the Hibernate session not being found. For example, if we have a domain class like this: class Car { Manufacturer manufacturer Engine engine Tyre...
Mar 16th
3 notes
2 tags
Clojure first steps
This post is the first (I hope) of a series about my adventure in Clojure land. Being Clojure hosted on the JVM, it’s a natural choice for a Java developer wanting to study and learn functional languages. A simple exercise I started with a simple exercise: add all the natural numbers between 1 and 100 which are multiple of 5 or 7 ; Add all the natural numbers below 100 that are multiples...
Mar 12th
1 note
3 tags
Custom property editor for Grails
Problem: Create a custom property editor between Model and View to show it as we need. (example: we wanted to change how shows the java Date.class in a view, from default format ‘yyyy-MM-dd HH:mm:ss.S’ to ‘dd-MM-yyyy’). Solution: There are 2 solutions which I can see now. The first one is, when every time we show a Date object, format it using a java DateFormat implement and show it. But the...
Mar 11th
1 note
2 tags
Groovy tip for simpler test case
When writing a groovy test case you almost want to be concise and expressive… next time you’ll see the test you must undestand it quickly. Here’s a small tip to enhance test writing. Having  : def car = new Car() def jack = new People() def tom = new Cat(); Instead of writing somethings like : car.addPeople ( people ) car.addCat ( tom ) it’s really simpler...
Mar 11th