Skip to content
Browse files

fix failing test

  • Loading branch information...
1 parent 64e6127 commit 561516c23316d91d5c2aac65bfd53c71fa8149e4 @graemerocher graemerocher committed Oct 10, 2012
View
15 ...ernate/src/main/groovy/org/codehaus/groovy/grails/orm/hibernate/query/HibernateQuery.java
@@ -59,6 +59,7 @@
@SuppressWarnings("rawtypes")
public class HibernateQuery extends Query {
+ public static final String SIZE_CONSTRAINT_PREFIX = "Size";
private Criteria criteria;
private HibernateQuery.HibernateProjectionList hibernateProjectionList = null;
private String alias;
@@ -119,6 +120,7 @@ else if (criterion instanceof PropertyCriterion) {
DetachedCriteria hibernateDetachedCriteria = HibernateCriteriaBuilder.getHibernateDetachedCriteria((QueryableCriteria) value);
pc.setValue(hibernateDetachedCriteria);
}
+ // ignore Size related constraints
else {
doTypeConversionIfNeccessary(getEntity(), pc);
}
@@ -130,11 +132,14 @@ else if (criterion instanceof PropertyCriterion) {
}
static void doTypeConversionIfNeccessary(PersistentEntity entity, PropertyCriterion pc) {
- String property = pc.getProperty();
- Object value = pc.getValue();
- PersistentProperty p = entity.getPropertyByName(property);
- if(p != null && !p.getType().isInstance(value)) {
- pc.setValue( conversionService.convert(value, p.getType()));
+ if(!pc.getClass().getSimpleName().startsWith(SIZE_CONSTRAINT_PREFIX)) {
+
+ String property = pc.getProperty();
+ Object value = pc.getValue();
+ PersistentProperty p = entity.getPropertyByName(property);
+ if(p != null && !p.getType().isInstance(value)) {
+ pc.setValue( conversionService.convert(value, p.getType()));
+ }
}
}

0 comments on commit 561516c

Please sign in to comment.
Something went wrong with that request. Please try again.