Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #166 from johnrengelman/master

GRAILS-8444, GRAILS-8486
  • Loading branch information...
commit 6299330816d778afcf50e03b5954c37e9f63b618 2 parents 6ff49a0 + df99e03
@graemerocher graemerocher authored
View
16 grails-hibernate/src/main/groovy/org/codehaus/groovy/grails/orm/hibernate/cfg/GrailsDomainBinder.java
@@ -823,11 +823,19 @@ else if (mapping != null) {
private static void bindColumnConfigToColumn(Column column, ColumnConfig columnConfig) {
if (columnConfig != null) {
- column.setLength(columnConfig.getLength());
- column.setPrecision(columnConfig.getPrecision());
- column.setSqlType(columnConfig.getSqlType());
+ if(columnConfig.getLength() != -1) {
+ column.setLength(columnConfig.getLength());
+ }
+ if(columnConfig.getPrecision() != -1) {
+ column.setPrecision(columnConfig.getPrecision());
+ }
+ if(columnConfig.getScale() != -1) {
+ column.setScale(columnConfig.getScale());
+ }
+ if(columnConfig.getSqlType() != null && !columnConfig.getSqlType().isEmpty()) {
+ column.setSqlType(columnConfig.getSqlType());
+ }
column.setUnique(columnConfig.getUnique());
- column.setScale(columnConfig.getScale());
}
}
View
2  ...-persistence/src/test/groovy/org/codehaus/groovy/grails/orm/hibernate/cfg/GrailsDomainBinderTests.groovy
@@ -947,6 +947,8 @@ class Alert {
assertNotNull(enumColumn)
assertEquals(5, enumColumn.length)
assertEquals('char', enumColumn.sqlType)
+ assertEquals(Column.DEFAULT_PRECISION, enumColumn.precision)
+ assertEquals(Column.DEFAULT_SCALE, enumColumn.scale)
}
private org.hibernate.mapping.Collection findCollection(DefaultGrailsDomainConfiguration config, String role) {
Please sign in to comment.
Something went wrong with that request. Please try again.