deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [2/2] git commit: DELTASPIKE-699 Relaxed signature for criteria methods
Date Tue, 09 Sep 2014 09:40:52 GMT
DELTASPIKE-699 Relaxed signature for criteria methods


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/13e1d4d0
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/13e1d4d0
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/13e1d4d0

Branch: refs/heads/master
Commit: 13e1d4d0df5a9d453b91d151abf54866fa1f6d7d
Parents: 04ee688
Author: Thomas Hug <Thomas.Hug@ctp.com>
Authored: Fri Aug 29 16:44:09 2014 +0200
Committer: Thomas Hug <Thomas.Hug@ctp.com>
Committed: Fri Aug 29 16:47:55 2014 +0200

----------------------------------------------------------------------
 .../data/api/criteria/CriteriaSupport.java      | 28 ++++++++++----------
 .../selection/AttributeQuerySelection.java      |  2 +-
 .../selection/SingularAttributeSelection.java   |  6 ++---
 .../impl/criteria/selection/numeric/Abs.java    |  2 +-
 .../impl/criteria/selection/numeric/Avg.java    |  2 +-
 .../impl/criteria/selection/numeric/Count.java  |  4 +--
 .../selection/numeric/CountDistinct.java        |  4 +--
 .../impl/criteria/selection/numeric/Max.java    |  2 +-
 .../impl/criteria/selection/numeric/Min.java    |  2 +-
 .../impl/criteria/selection/numeric/Modulo.java |  2 +-
 .../impl/criteria/selection/numeric/Neg.java    |  2 +-
 .../impl/criteria/selection/numeric/Sum.java    |  2 +-
 .../impl/criteria/selection/strings/Lower.java  |  2 +-
 .../selection/strings/SubstringFrom.java        |  2 +-
 .../selection/strings/SubstringFromTo.java      |  2 +-
 .../impl/criteria/selection/strings/Upper.java  |  2 +-
 .../impl/handler/CriteriaSupportHandler.java    | 28 ++++++++++----------
 .../data/impl/criteria/CriteriaTest.java        | 18 +++++++++++++
 .../deltaspike/data/test/domain/Simple.java     |  2 +-
 .../data/test/domain/SuperSimple.java           | 20 ++++++++++++++
 .../test/service/SimpleCriteriaRepository.java  |  7 +++++
 21 files changed, 93 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/criteria/CriteriaSupport.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/criteria/CriteriaSupport.java
b/deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/criteria/CriteriaSupport.java
index 2dd386d..fa8ea2c 100644
--- a/deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/criteria/CriteriaSupport.java
+++ b/deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/criteria/CriteriaSupport.java
@@ -61,7 +61,7 @@ public interface CriteriaSupport<E>
      * @param attribute Attribute to show up in the result selection
      * @return          {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)}
call.
      */
-    <X> QuerySelection<E, X> attribute(SingularAttribute<E, X> attribute);
+    <X> QuerySelection<E, X> attribute(SingularAttribute<? super E, X>
attribute);
 
     /**
      * Create a query selection for the
@@ -70,7 +70,7 @@ public interface CriteriaSupport<E>
      * @param attribute Attribute to use in the aggregate.
      * @return          {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)}
call.
      */
-    <N extends Number> QuerySelection<E, N> abs(SingularAttribute<E, N>
attribute);
+    <N extends Number> QuerySelection<E, N> abs(SingularAttribute<? super
E, N> attribute);
 
     /**
      * Create a query selection for the
@@ -79,7 +79,7 @@ public interface CriteriaSupport<E>
      * @param attribute Attribute to use in the aggregate.
      * @return          {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)}
call.
      */
-    <N extends Number> QuerySelection<E, N> avg(SingularAttribute<E, N>
attribute);
+    <N extends Number> QuerySelection<E, N> avg(SingularAttribute<? super
E, N> attribute);
 
     /**
      * Create a query selection for the
@@ -88,7 +88,7 @@ public interface CriteriaSupport<E>
      * @param attribute Attribute to use in the aggregate.
      * @return          {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)}
call.
      */
-    QuerySelection<E, Long> count(SingularAttribute<E, ?> attribute);
+    QuerySelection<E, Long> count(SingularAttribute<? super E, ?> attribute);
 
     /**
      * Create a query selection for the
@@ -97,7 +97,7 @@ public interface CriteriaSupport<E>
      * @param attribute Attribute to use in the aggregate.
      * @return          {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)}
call.
      */
-    QuerySelection<E, Long> countDistinct(SingularAttribute<E, ?> attribute);
+    QuerySelection<E, Long> countDistinct(SingularAttribute<? super E, ?> attribute);
 
     /**
      * Create a query selection for the
@@ -106,7 +106,7 @@ public interface CriteriaSupport<E>
      * @param attribute Attribute to use in the aggregate.
      * @return          {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)}
call.
      */
-    <N extends Number> QuerySelection<E, N> max(SingularAttribute<E, N>
attribute);
+    <N extends Number> QuerySelection<E, N> max(SingularAttribute<? super
E, N> attribute);
 
     /**
      * Create a query selection for the
@@ -115,7 +115,7 @@ public interface CriteriaSupport<E>
      * @param attribute Attribute to use in the aggregate.
      * @return          {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)}
call.
      */
-    <N extends Number> QuerySelection<E, N> min(SingularAttribute<E, N>
attribute);
+    <N extends Number> QuerySelection<E, N> min(SingularAttribute<? super
E, N> attribute);
 
     /**
      * Create a query selection for the
@@ -124,7 +124,7 @@ public interface CriteriaSupport<E>
      * @param attribute Attribute to use in the aggregate.
      * @return          {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)}
call.
      */
-    <N extends Number> QuerySelection<E, N> neg(SingularAttribute<E, N>
attribute);
+    <N extends Number> QuerySelection<E, N> neg(SingularAttribute<? super
E, N> attribute);
 
     /**
      * Create a query selection for the
@@ -133,7 +133,7 @@ public interface CriteriaSupport<E>
      * @param attribute Attribute to use in the aggregate.
      * @return          {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)}
call.
      */
-    <N extends Number> QuerySelection<E, N> sum(SingularAttribute<E, N>
attribute);
+    <N extends Number> QuerySelection<E, N> sum(SingularAttribute<? super
E, N> attribute);
 
     /**
      * Create a query selection for the
@@ -143,7 +143,7 @@ public interface CriteriaSupport<E>
      * @param modulo    Modulo what.
      * @return          {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)}
call.
      */
-    QuerySelection<E, Integer> modulo(SingularAttribute<E, Integer> attribute,
Integer modulo);
+    QuerySelection<E, Integer> modulo(SingularAttribute<? super E, Integer> attribute,
Integer modulo);
 
     /**
      * Create a query selection for the
@@ -152,7 +152,7 @@ public interface CriteriaSupport<E>
      * @param attribute Attribute to uppercase.
      * @return          {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)}
call.
      */
-    QuerySelection<E, String> upper(SingularAttribute<E, String> attribute);
+    QuerySelection<E, String> upper(SingularAttribute<? super E, String> attribute);
 
     /**
      * Create a query selection for the
@@ -161,7 +161,7 @@ public interface CriteriaSupport<E>
      * @param attribute Attribute to lowercase.
      * @return          {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)}
call.
      */
-    QuerySelection<E, String> lower(SingularAttribute<E, String> attribute);
+    QuerySelection<E, String> lower(SingularAttribute<? super E, String> attribute);
 
     /**
      * Create a query selection for the
@@ -171,7 +171,7 @@ public interface CriteriaSupport<E>
      * @param from      Substring start.
      * @return          {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)}
call.
      */
-    QuerySelection<E, String> substring(SingularAttribute<E, String> attribute,
int from);
+    QuerySelection<E, String> substring(SingularAttribute<? super E, String>
attribute, int from);
 
     /**
      * Create a query selection for the
@@ -182,7 +182,7 @@ public interface CriteriaSupport<E>
      * @param length    Substring length.
      * @return          {@link QuerySelection} part of a {@link Criteria#select(Class, QuerySelection...)}
call.
      */
-    QuerySelection<E, String> substring(SingularAttribute<E, String> attribute,
int from, int length);
+    QuerySelection<E, String> substring(SingularAttribute<? super E, String>
attribute, int from, int length);
 
     /**
      * Create a query selection for the {@link javax.persistence.criteria.CriteriaBuilder#currentDate()}.

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/AttributeQuerySelection.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/AttributeQuerySelection.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/AttributeQuerySelection.java
index 2cecf7c..a1798f5 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/AttributeQuerySelection.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/AttributeQuerySelection.java
@@ -27,7 +27,7 @@ import javax.persistence.metamodel.SingularAttribute;
 public class AttributeQuerySelection<P, X> extends SingularAttributeSelection<P,
X>
 {
 
-    public AttributeQuerySelection(SingularAttribute<P, X> attribute)
+    public AttributeQuerySelection(SingularAttribute<? super P, X> attribute)
     {
         super(attribute);
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/SingularAttributeSelection.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/SingularAttributeSelection.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/SingularAttributeSelection.java
index f2333fe..0063431 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/SingularAttributeSelection.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/SingularAttributeSelection.java
@@ -25,14 +25,14 @@ import org.apache.deltaspike.data.api.criteria.QuerySelection;
 public abstract class SingularAttributeSelection<P, X> implements QuerySelection<P,
X>
 {
 
-    protected final SingularAttribute<P, X> attribute;
+    protected final SingularAttribute<? super P, X> attribute;
 
-    public SingularAttributeSelection(SingularAttribute<P, X> attribute)
+    public SingularAttributeSelection(SingularAttribute<? super P, X> attribute)
     {
         this.attribute = attribute;
     }
 
-    public SingularAttribute<P, X> getAttribute()
+    public SingularAttribute<? super P, X> getAttribute()
     {
         return attribute;
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Abs.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Abs.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Abs.java
index 914d56f..ed3af8c 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Abs.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Abs.java
@@ -29,7 +29,7 @@ import org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelec
 public class Abs<P, X extends Number> extends SingularAttributeSelection<P, X>
 {
 
-    public Abs(SingularAttribute<P, X> attribute)
+    public Abs(SingularAttribute<? super P, X> attribute)
     {
         super(attribute);
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Avg.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Avg.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Avg.java
index ce9dcd4..8e4f250 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Avg.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Avg.java
@@ -29,7 +29,7 @@ import org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelec
 public class Avg<P, X extends Number> extends SingularAttributeSelection<P, X>
 {
 
-    public Avg(SingularAttribute<P, X> attribute)
+    public Avg(SingularAttribute<? super P, X> attribute)
     {
         super(attribute);
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Count.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Count.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Count.java
index 7bb3688..545ad65 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Count.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Count.java
@@ -29,9 +29,9 @@ import org.apache.deltaspike.data.api.criteria.QuerySelection;
 public class Count<P> implements QuerySelection<P, Long>
 {
 
-    private final SingularAttribute<P, ?> attribute;
+    private final SingularAttribute<? super P, ?> attribute;
 
-    public Count(SingularAttribute<P, ?> attribute)
+    public Count(SingularAttribute<? super P, ?> attribute)
     {
         this.attribute = attribute;
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/CountDistinct.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/CountDistinct.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/CountDistinct.java
index 024279b..82677c7 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/CountDistinct.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/CountDistinct.java
@@ -29,9 +29,9 @@ import org.apache.deltaspike.data.api.criteria.QuerySelection;
 public class CountDistinct<P> implements QuerySelection<P, Long>
 {
 
-    private final SingularAttribute<P, ?> attribute;
+    private final SingularAttribute<? super P, ?> attribute;
 
-    public CountDistinct(SingularAttribute<P, ?> attribute)
+    public CountDistinct(SingularAttribute<? super P, ?> attribute)
     {
         this.attribute = attribute;
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Max.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Max.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Max.java
index cff658b..b49b5fd 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Max.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Max.java
@@ -29,7 +29,7 @@ import org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelec
 public class Max<P, X extends Number> extends SingularAttributeSelection<P, X>
 {
 
-    public Max(SingularAttribute<P, X> attribute)
+    public Max(SingularAttribute<? super P, X> attribute)
     {
         super(attribute);
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Min.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Min.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Min.java
index 127fb79..1141bfe 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Min.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Min.java
@@ -29,7 +29,7 @@ import org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelec
 public class Min<P, X extends Number> extends SingularAttributeSelection<P, X>
 {
 
-    public Min(SingularAttribute<P, X> attribute)
+    public Min(SingularAttribute<? super P, X> attribute)
     {
         super(attribute);
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Modulo.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Modulo.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Modulo.java
index 914ec4f..4118fd1 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Modulo.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Modulo.java
@@ -31,7 +31,7 @@ public class Modulo<P> extends SingularAttributeSelection<P, Integer>
 
     private final Integer modulo;
 
-    public Modulo(SingularAttribute<P, Integer> attribute, Integer modulo)
+    public Modulo(SingularAttribute<? super P, Integer> attribute, Integer modulo)
     {
         super(attribute);
         this.modulo = modulo;

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Neg.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Neg.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Neg.java
index e09a183..706ed4b 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Neg.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Neg.java
@@ -29,7 +29,7 @@ import org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelec
 public class Neg<P, X extends Number> extends SingularAttributeSelection<P, X>
 {
 
-    public Neg(SingularAttribute<P, X> attribute)
+    public Neg(SingularAttribute<? super P, X> attribute)
     {
         super(attribute);
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Sum.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Sum.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Sum.java
index 4048cc1..124cbc8 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Sum.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/numeric/Sum.java
@@ -29,7 +29,7 @@ import org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelec
 public class Sum<P, X extends Number> extends SingularAttributeSelection<P, X>
 {
 
-    public Sum(SingularAttribute<P, X> attribute)
+    public Sum(SingularAttribute<? super P, X> attribute)
     {
         super(attribute);
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/Lower.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/Lower.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/Lower.java
index aec917a..dff4923 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/Lower.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/Lower.java
@@ -29,7 +29,7 @@ import org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelec
 public class Lower<P> extends SingularAttributeSelection<P, String>
 {
 
-    public Lower(SingularAttribute<P, String> attribute)
+    public Lower(SingularAttribute<? super P, String> attribute)
     {
         super(attribute);
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/SubstringFrom.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/SubstringFrom.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/SubstringFrom.java
index 906ac30..17a589c 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/SubstringFrom.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/SubstringFrom.java
@@ -31,7 +31,7 @@ public class SubstringFrom<P> extends SingularAttributeSelection<P,
String>
 
     private final int from;
 
-    public SubstringFrom(SingularAttribute<P, String> attribute, int from)
+    public SubstringFrom(SingularAttribute<? super P, String> attribute, int from)
     {
         super(attribute);
         this.from = from;

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/SubstringFromTo.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/SubstringFromTo.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/SubstringFromTo.java
index 5fcecad..02d88b5 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/SubstringFromTo.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/SubstringFromTo.java
@@ -29,7 +29,7 @@ public class SubstringFromTo<P> extends SubstringFrom<P>
 
     private final int length;
 
-    public SubstringFromTo(SingularAttribute<P, String> attribute, int from, int length)
+    public SubstringFromTo(SingularAttribute<? super P, String> attribute, int from,
int length)
     {
         super(attribute, from);
         this.length = length;

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/Upper.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/Upper.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/Upper.java
index a7e9166..279ccaa 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/Upper.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/criteria/selection/strings/Upper.java
@@ -29,7 +29,7 @@ import org.apache.deltaspike.data.impl.criteria.selection.SingularAttributeSelec
 public class Upper<P> extends SingularAttributeSelection<P, String>
 {
 
-    public Upper(SingularAttribute<P, String> attribute)
+    public Upper(SingularAttribute<? super P, String> attribute)
     {
         super(attribute);
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/CriteriaSupportHandler.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/CriteriaSupportHandler.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/CriteriaSupportHandler.java
index c65588f..91c3ebc 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/CriteriaSupportHandler.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/CriteriaSupportHandler.java
@@ -71,7 +71,7 @@ public class CriteriaSupportHandler<E> extends AbstractDelegateQueryHandler<E>
i
     }
 
     @Override
-    public <X> QuerySelection<E, X> attribute(SingularAttribute<E, X> attribute)
+    public <X> QuerySelection<E, X> attribute(SingularAttribute<? super E,
X> attribute)
     {
         return new AttributeQuerySelection<E, X>(attribute);
     }
@@ -81,55 +81,55 @@ public class CriteriaSupportHandler<E> extends AbstractDelegateQueryHandler<E>
i
     // ----------------------------------------------------------------------------
 
     @Override
-    public <N extends Number> QuerySelection<E, N> abs(SingularAttribute<E,
N> attribute)
+    public <N extends Number> QuerySelection<E, N> abs(SingularAttribute<?
super E, N> attribute)
     {
         return new Abs<E, N>(attribute);
     }
 
     @Override
-    public <N extends Number> QuerySelection<E, N> avg(SingularAttribute<E,
N> attribute)
+    public <N extends Number> QuerySelection<E, N> avg(SingularAttribute<?
super E, N> attribute)
     {
         return new Avg<E, N>(attribute);
     }
 
     @Override
-    public QuerySelection<E, Long> count(SingularAttribute<E, ?> attribute)
+    public QuerySelection<E, Long> count(SingularAttribute<? super E, ?> attribute)
     {
         return new Count<E>(attribute);
     }
 
     @Override
-    public QuerySelection<E, Long> countDistinct(SingularAttribute<E, ?> attribute)
+    public QuerySelection<E, Long> countDistinct(SingularAttribute<? super E, ?>
attribute)
     {
         return new CountDistinct<E>(attribute);
     }
 
     @Override
-    public <N extends Number> QuerySelection<E, N> max(SingularAttribute<E,
N> attribute)
+    public <N extends Number> QuerySelection<E, N> max(SingularAttribute<?
super E, N> attribute)
     {
         return new Max<E, N>(attribute);
     }
 
     @Override
-    public <N extends Number> QuerySelection<E, N> min(SingularAttribute<E,
N> attribute)
+    public <N extends Number> QuerySelection<E, N> min(SingularAttribute<?
super E, N> attribute)
     {
         return new Min<E, N>(attribute);
     }
 
     @Override
-    public <N extends Number> QuerySelection<E, N> neg(SingularAttribute<E,
N> attribute)
+    public <N extends Number> QuerySelection<E, N> neg(SingularAttribute<?
super E, N> attribute)
     {
         return new Neg<E, N>(attribute);
     }
 
     @Override
-    public <N extends Number> QuerySelection<E, N> sum(SingularAttribute<E,
N> attribute)
+    public <N extends Number> QuerySelection<E, N> sum(SingularAttribute<?
super E, N> attribute)
     {
         return new Sum<E, N>(attribute);
     }
 
     @Override
-    public QuerySelection<E, Integer> modulo(SingularAttribute<E, Integer> attribute,
Integer modulo)
+    public QuerySelection<E, Integer> modulo(SingularAttribute<? super E, Integer>
attribute, Integer modulo)
     {
         return new Modulo<E>(attribute, modulo);
     }
@@ -139,25 +139,25 @@ public class CriteriaSupportHandler<E> extends AbstractDelegateQueryHandler<E>
i
     // ----------------------------------------------------------------------------
 
     @Override
-    public QuerySelection<E, String> upper(SingularAttribute<E, String> attribute)
+    public QuerySelection<E, String> upper(SingularAttribute<? super E, String>
attribute)
     {
         return new Upper<E>(attribute);
     }
 
     @Override
-    public QuerySelection<E, String> lower(SingularAttribute<E, String> attribute)
+    public QuerySelection<E, String> lower(SingularAttribute<? super E, String>
attribute)
     {
         return new Lower<E>(attribute);
     }
 
     @Override
-    public QuerySelection<E, String> substring(SingularAttribute<E, String> attribute,
int from)
+    public QuerySelection<E, String> substring(SingularAttribute<? super E, String>
attribute, int from)
     {
         return new SubstringFrom<E>(attribute, from);
     }
 
     @Override
-    public QuerySelection<E, String> substring(SingularAttribute<E, String> attribute,
int from, int length)
+    public QuerySelection<E, String> substring(SingularAttribute<? super E, String>
attribute, int from, int length)
     {
         return new SubstringFromTo<E>(attribute, from, length);
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/criteria/CriteriaTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/criteria/CriteriaTest.java
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/criteria/CriteriaTest.java
index 031b0da..63fef58 100644
--- a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/criteria/CriteriaTest.java
+++ b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/criteria/CriteriaTest.java
@@ -384,6 +384,24 @@ public class CriteriaTest extends TransactionalTestCase
         assertEquals(1, result.size());
     }
 
+    @Test
+    public void should_query_with_att_from_mapped_super()
+    {
+        // given
+        final String name = "should_create_date_criteria";
+        final String superName = "super_should_create_date_criteria";
+        final Simple simple = new Simple(name);
+        simple.setSuperName(superName);
+        entityManager.persist(simple);
+        entityManager.flush();
+
+        // when
+        final Simple result = repo.findBySuperName(superName);
+
+        // then
+        assertEquals(superName, result.getSuperName());
+    }
+
     @Override
     protected EntityManager getEntityManager()
     {

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/Simple.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/Simple.java
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/Simple.java
index 5fadc99..93ad8a5 100755
--- a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/Simple.java
+++ b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/Simple.java
@@ -39,7 +39,7 @@ import javax.persistence.TemporalType;
                    query = "select s from Simple s where s.id = :id and s.enabled = :enabled")
 })
 @Table(name = "SIMPLE_TABLE")
-public class Simple
+public class Simple extends SuperSimple
 {
 
     public static final String BY_NAME_LIKE = "simple.byNameLike";

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/SuperSimple.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/SuperSimple.java
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/SuperSimple.java
new file mode 100644
index 0000000..bbf1ea7
--- /dev/null
+++ b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/domain/SuperSimple.java
@@ -0,0 +1,20 @@
+package org.apache.deltaspike.data.test.domain;
+
+import javax.persistence.MappedSuperclass;
+
+@MappedSuperclass
+public class SuperSimple
+{
+    private String superName;
+
+    public String getSuperName()
+    {
+        return superName;
+    }
+
+    public void setSuperName(String superName)
+    {
+        this.superName = superName;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13e1d4d0/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleCriteriaRepository.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleCriteriaRepository.java
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleCriteriaRepository.java
index c911b25..acbaeb1 100644
--- a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleCriteriaRepository.java
+++ b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleCriteriaRepository.java
@@ -26,6 +26,7 @@ import org.apache.deltaspike.data.api.Repository;
 import org.apache.deltaspike.data.api.criteria.CriteriaSupport;
 import org.apache.deltaspike.data.test.domain.Simple;
 import org.apache.deltaspike.data.test.domain.Simple_;
+import org.apache.deltaspike.data.test.domain.SuperSimple_;
 
 @Repository
 public abstract class SimpleCriteriaRepository extends AbstractEntityRepository<Simple,
Long>
@@ -62,6 +63,12 @@ public abstract class SimpleCriteriaRepository extends AbstractEntityRepository<
                  .getResultList();
     }
 
+    public Simple findBySuperName(String superName) {
+        return criteria()
+                 .eq(SuperSimple_.superName, superName)
+                 .getSingleResult();
+    }
+
     public Long criteriaCount(String name)
     {
         return criteria()


Mime
View raw message