Vivek Krishna

Open Source Enthusiast, Agile Practitioner, Grails Lover, jQuery Worshiper.

Grails

Clearing Hibernate Query Cache in Grails

In one of the projects, we had used Query Caching to improve the performance. However, it also meant that the updates/inserts into a table did not get reflected immediately, i.e. something like: DomainClass.findByPropertyName("propertyName", [cache: true]) returned the same list as it was, before the insertion/updation took place....

23-Jun-2010

Grails

Script for Running Grails Projects of Different Versions Simultaneously

Sometimes it is required that multiple Grails projects, hosted on a different Grails version, run simultaneously. In this case, while fixing bugs, you are required to run the application after switching the Grails version each time. To handle this scenario, I wrote a utility shell script "runGrails" to use a particular version of...

18-Jun-2010

Technology

Changing Location of MySql DataStore

On one of our projects, we had to store the MySql Data at a location different from the default location. This was needed because the server was on an instance-store Amazon instance which meant that the data would get lost if the instance had to be rebooted for some reason. After going through the tutorials and articles on AWS, we came...

07-Jun-2010

Grails

Overriding default Transactional Behaviour in Grails Services using Annotations

In a project, we needed to have fine tune the transaction behaviour on our Service classes. One service method was calling the a method in another service. The calling service method A was to happen in one transaction and the called service method B in its own transaction. This was required because we needed to persist the error log from...

28-Apr-2010

Grails

Injecting Spring Beans with data from Config

In one of the projects, we had to externalize the Config file to be in a properties file. All configurations related to the application were to be stored in that file. We had a few spring beans, like the JMS connection factory, which needs the brokerURL which should ideally be an external configuration as it is will be environment...

15-Apr-2010

Grails

Grails JMS Plugin and Redelivery Policy

On a project, we needed to configure the redelivery mechanism for the JMS queue. That is, a poisonous message was to be sent to a Dead Letter Queue if a set number of attempts failed, so that the other messages in the queue could be processed. The JMS Plugin version used was 0.5 Merely configuring ActiveMQ for setting up a Dead Letter...

18-Mar-2010

Grails

Accessing Spring Beans by Implementing ApplicationContextAware in Grails Artefacts

Many a times, it is required to inject a Spring Bean into a Grails artefact. It has happened a few times with us in our projects that we needed to inject a TagLib bean in the service layer for code re-use for sending out e-mails. This is how we achieved it MyService implements org.springframework.context.ApplicationContext Import...

20-Nov-2009

Grails

Accessing Session Map in the Domain or Service Layer

The Session Map is available in Grails in the Views, TagLibs and the Controllers. That is, it can be directly accessed by the name "session". If the Session Map is required to be accessed in the Service Layer or the Domain layer, such a straightforward approach will not work. In this case, a class which is a part of the Spring Framework...

16-Jul-2009