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