Add not member of pattern

This commit is contained in:
Timo Westkämper 2013-10-08 18:27:35 +04:00
parent e3b35dbb65
commit baaaa6ca73

View File

@ -1,6 +1,6 @@
/*
* Copyright 2011, Mysema Ltd
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -28,9 +28,9 @@ import com.mysema.query.types.PathType;
*
*/
public class HQLTemplates extends JPQLTemplates {
private static final QueryHandler QUERY_HANDLER;
static {
QueryHandler instance;
try {
@ -54,7 +54,7 @@ public class HQLTemplates extends JPQLTemplates {
public HQLTemplates() {
this(DEFAULT_ESCAPE);
}
public HQLTemplates(char escape) {
super(escape, QUERY_HANDLER);
// TODO : remove this when Hibernate supports type(alias)
@ -62,7 +62,8 @@ public class HQLTemplates extends JPQLTemplates {
// TODO : remove this when Hibernate supports type(alias)
add(TYPE, "{0}.class");
// TODO : remove this when Hibernate supports member of properly
add(MEMBER_OF, "{0} in elements({1})");
add(MEMBER_OF, "{0} in elements({1})");
add(NOT_MEMBER_OF, "{0} not in elements({1})");
// path types
for (PathType type : new PathType[] {
@ -73,7 +74,7 @@ public class HQLTemplates extends JPQLTemplates {
}
add(PathType.LISTVALUE_CONSTANT, "{0}[{1s}]");
add(PathType.COLLECTION_ANY, "any elements({0})");
add(Ops.CONTAINS_KEY, "{1} in indices({0})");
add(Ops.CONTAINS_VALUE, "{1} in elements({0})");
}
@ -92,29 +93,29 @@ public class HQLTemplates extends JPQLTemplates {
public String getExistsProjection() {
return "1";
}
@Override
public boolean isSelect1Supported() {
// TODO return true, when JPQLTemplates becomes standard
return false;
}
@Override
public boolean isEnumInPathSupported() {
// related : http://opensource.atlassian.com/projects/hibernate/browse/HHH-5159
return false;
}
@Override
public boolean wrapConstant(Object constant) {
// related : https://hibernate.onjira.com/browse/HHH-6913
Class<?> type = constant.getClass();
return type.isArray() || Collection.class.isAssignableFrom(type);
}
@Override
public boolean isWithForOn() {
return true;
}
}