Sandeep Poonia

I have been programming for over 10 years. I've never stopped learning or teaching during that time. I work hard to write good, reliable, and maintainable code. I'm passionate about making people's lives better through software. Whether it's a small piece of functionality implemented in a way that is seamless to the user, or it's a large-scale effort to improve the performance and usability of software, I'm there. I love programming, I'm pretty good at it.

Technology

Mongo Case Insensitive InList Query

As we know in Mongo the match queries are case sensitive. So whether we do a find() operation or use $match stage of aggregate pipeline, the condition would be true only if its a exact case sensitive match. Of cource we can use regex to do case insensitive queries but then again it will not work when we are trying to find a match with in...

23-Jul-2016

Grails, Technology

Using Hibernate Events with PersistenceEventListener

In my last blog, we discussed how to hook into GORM API to add some common custom functionality. We will refer the same problem that we discussed in my last blog. Here is the problem statement: In my grails plugin I was needed to add some fields that were common to a set of domains. For eg: for some domains we wanted to store fields like...

23-Jul-2016

Grails

Hooking into the Instance methods of the GORM API

In my grails plugin I was needed to add some fields that were common to a set of domains. For eg: for some domains we wanted to store fields like createdBy and lastUpdatedBy to keep track of users who created and last updated each record in that domain. Grails framework provides timestamping using which we can keep track of the time a...

30-Jan-2016

Grails, Technology

Intercept Grails Service class method calls

I was trying to intercept method calls of a Grails Service class for a little while. Adding interceptors to Controllers is really easy and I wanted to intercept calls to one of the methods in a Service class in a similar fashion. But adding interceptors to Grails Service Classes is not as straightforward as for Controllers. After doing...

30-Oct-2015

Grails, Technology

Grails Filter at top of Filter Invocation Chain

Sometimes in a web application we need filtering on request to a resource or on response, or on both. In Grails, it could be done easily via creating a filter. Just run grails create-filters [filter-name] and it will generate a filter in the application. To run a filter before all other filters, just put that filter at top of other...

27-Jul-2015

Grails, Technology

Externalize and reload grails Log4j configuration

In Grails 2.x and in some earlier versions, the log4j configuration resides in grails-app/conf/Config.groovy. We can modify log4j closure here to add new categories and tweak the log levels. In development environemnt any changes to log4j closure are loaded automatically without bouncing the application, but not when the application is...

01-Jul-2015

Grails

Log SQL Query with Data Bindings in grails for a piece of code

Although in grails, we can use the logSql property in the DataSource file to log SQL queries or enable loggers "org.hibernate.SQL" for logging queries and "org.hibernate.type.descriptor.sql.BasicBinder" for logging bindings. But this solution wouldn't be that much helpful if we just want the logging for a particular piece of code rather...

23-Apr-2015

Grails

Parsing URL Mappings in Grails

There are times when we need to parse the URL mappings in our grails app. In my case we have a REST API. In which we have implemented a generic query method for all controllers but it is available to only a few using custom URL mappings. We wanted to create test cases in such a way for query action that each time a test case runs it...

17-Apr-2015