Marcin Świerczyński's blog

Marcin Świerczyński

My name is Marcin Świerczyński. I'm a software developer especially interested in Java and Python languages, Java-based technologies and mobile applications development.

I'll be writing here about interesting issues I faced during my programming adventures. I hope you'll find the solutions useful.

Null Value on Save Issue in Grails

posted 22 Jul 2010

If you’ve used Grails, you’re probably familiar with a domain class and its “constraints” block. There you can define conditions which have to be met by class’s fields. For example, you can enforce that a field have to be not-empty using “blank: false” condition. It’d be intuitive not to define conditions for the field you don’t care of. Unfortunately, there is a small trap here. Let’s use an example to explain it. Let’s define an...

¬ read more

Initial value of primary key in Grails

posted 22 Jul 2010

I’ve recently came across a small issue in my Grails application. I had to set an initial value of auto-generated identifiers of my objects. Moreover, I had to use two different values in two classes. For example, identifiers in one table in database should start from 50, while in another table – from 1000. How to get this in Grails domain classes? You have to use SequenceStyleGenerator with its parameter – initial_value. You can do...

¬ read more