Category Archives: Groovy Grails

Grails generate-all Example

Use the grails generate-all command to create controller, views, and controller unit tests. First, define a domain such as the below User. package wolbay class User { String userId String password static constraints = { userId(length:6..8,unique:true) password(length:6..8) } } Second, … Continue reading

Posted in Groovy Grails | Comments Off on Grails generate-all Example

Groovy URL example to check if web application is alive

Here is a handy KeepAlive.groovy script that will simply connect to a web application to make sure it’s alive.  The database connection for the web application would often timeout because of lack of activity, especially during non-work hours. By periodically … Continue reading

Posted in Groovy Grails | Comments Off on Groovy URL example to check if web application is alive

Grails Transient properties in a domain class

Transient properties are useful to carry additional meta data in a domain class without a direct database mapping required.  Transient properties can be useful to handle read only information queried from multiple databases. static transients = [‘manuf’, ‘make’, ‘model’] String … Continue reading

Posted in Groovy Grails | Comments Off on Grails Transient properties in a domain class