From b5b7453eeb933ff24c7f927536f8699a69c091f8 Mon Sep 17 00:00:00 2001 From: Neill Robbins Date: Wed, 26 Oct 2011 11:18:18 +0100 Subject: [PATCH] http://jira.grails.org/browse/GPREVERSEENGINEER-12 Fixes case where table being mapped has no primary key, but does have other constraints --- src/groovy/grails/plugin/reveng/GrailsEntityPOJOClass.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/groovy/grails/plugin/reveng/GrailsEntityPOJOClass.groovy b/src/groovy/grails/plugin/reveng/GrailsEntityPOJOClass.groovy index 03fc186..2c89859 100644 --- a/src/groovy/grails/plugin/reveng/GrailsEntityPOJOClass.groovy +++ b/src/groovy/grails/plugin/reveng/GrailsEntityPOJOClass.groovy @@ -311,7 +311,7 @@ class GrailsEntityPOJOClass extends EntityPOJOClass { } clazz.table.uniqueKeyIterator.each { UniqueKey key -> - if (key.columnSpan == 1 || key.name == clazz.table.primaryKey.name) return + if (key.columnSpan == 1 || key.name == clazz.table.primaryKey?.name) return if (key.columns[-1] == column) { def otherNames = key.columns[0..-2].collect { "\"$it.name\"" } values.unique = '[' + otherNames.reverse().join(', ') + ']'