diff --git a/ebean-api/src/main/java/io/ebean/SimpleProperty.java b/ebean-api/src/main/java/io/ebean/SimpleProperty.java index 044f2aa31..d4c3b8a68 100644 --- a/ebean-api/src/main/java/io/ebean/SimpleProperty.java +++ b/ebean-api/src/main/java/io/ebean/SimpleProperty.java @@ -1,6 +1,6 @@ package io.ebean; -final class SimpleProperty implements Query.Property { +final class SimpleProperty implements Query.Property { private final String expression; diff --git a/ebean-api/src/main/java/io/ebean/StdLegacyOps.java b/ebean-api/src/main/java/io/ebean/StdLegacyOps.java deleted file mode 100644 index c8da08b0a..000000000 --- a/ebean-api/src/main/java/io/ebean/StdLegacyOps.java +++ /dev/null @@ -1,37 +0,0 @@ -package io.ebean; - -import io.ebean.Query.Property; - -import java.time.temporal.Temporal; - -@Deprecated(since = "experimental") -public final class StdLegacyOps { - - public static Expression eq(Property property, java.util.Calendar value) { - return Expr.eq(property.toString(), value); - } - - public static Expression eqOrNull(Property property, java.util.Calendar value) { - return Expr.factory().eqOrNull(property.toString(), value); - } - - public static Expression ne(Property property, java.util.Calendar value) { - return Expr.factory().ne(property.toString(), value); - } - - public static Expression lt(Property property, java.util.Calendar value) { - return Expr.factory().lt(property.toString(), value); - } - - public static Expression ltOrNull(Property property, java.util.Calendar value) { - return Expr.factory().ltOrNull(property.toString(), value); - } - - public static Expression le(Property property, java.util.Calendar value) { - return Expr.factory().le(property.toString(), value); - } - - public static Expression leOrNull(Property property, java.util.Calendar value) { - return Expr.factory().leOrNull(property.toString(), value); - } -} diff --git a/ebean-api/src/main/java/io/ebean/StdOperators.java b/ebean-api/src/main/java/io/ebean/StdOperators.java index e049401d5..40bf84916 100644 --- a/ebean-api/src/main/java/io/ebean/StdOperators.java +++ b/ebean-api/src/main/java/io/ebean/StdOperators.java @@ -2,7 +2,6 @@ package io.ebean; import io.ebean.Query.Property; -import java.time.temporal.Temporal; import java.util.Collection; @Deprecated(since = "experimental") @@ -79,18 +78,10 @@ public final class StdOperators { return Expr.in(property.toString(), subQuery); } - public static Expression eq(Property property, java.util.Date value) { - return Expr.eq(property.toString(), value); - } - public static Expression eqOrNull(Property property, T value) { return Expr.factory().eqOrNull(property.toString(), value); } - public static Expression eqOrNull(Property property, java.util.Date value) { - return Expr.factory().eqOrNull(property.toString(), value); - } - public static Expression ne(Property property, T value) { return Expr.ne(property.toString(), value); } @@ -99,10 +90,6 @@ public final class StdOperators { return Expr.ne(property.toString(), subQuery); } - public static Expression ne(Property property, java.util.Date value) { - return Expr.ne(property.toString(), value); - } - public static Expression gt(Property property, T value) { return Expr.gt(property.toString(), value); } @@ -111,18 +98,10 @@ public final class StdOperators { return Expr.gt(property.toString(), subQuery); } - public static Expression gt(Property property, java.util.Date value) { - return Expr.gt(property.toString(), value); - } - public static Expression gtOrNull(Property property, T value) { return Expr.factory().gtOrNull(property.toString(), value); } - public static Expression gtOrNull(Property property, java.util.Date value) { - return Expr.factory().gtOrNull(property.toString(), value); - } - public static Expression ge(Property property, T value) { return Expr.ge(property.toString(), value); } @@ -131,18 +110,10 @@ public final class StdOperators { return Expr.ge(property.toString(), subQuery); } - public static Expression ge(Property property, java.util.Date value) { - return Expr.ge(property.toString(), value); - } - public static Expression geOrNull(Property property, T value) { return Expr.factory().geOrNull(property.toString(), value); } - public static Expression geOrNull(Property property, java.util.Date value) { - return Expr.factory().geOrNull(property.toString(), value); - } - public static Expression lt(Property property, T value) { return Expr.lt(property.toString(), value); } @@ -151,18 +122,10 @@ public final class StdOperators { return Expr.lt(property.toString(), subQuery); } - public static Expression lt(Property property, java.util.Date value) { - return Expr.lt(property.toString(), value); - } - public static Expression ltOrNull(Property property, T value) { return Expr.factory().ltOrNull(property.toString(), value); } - public static Expression ltOrNull(Property property, java.util.Date value) { - return Expr.factory().ltOrNull(property.toString(), value); - } - public static Expression le(Property property, T value) { return Expr.le(property.toString(), value); } @@ -171,34 +134,18 @@ public final class StdOperators { return Expr.le(property.toString(), subQuery); } - public static Expression le(Property property, java.util.Date value) { - return Expr.le(property.toString(), value); - } - public static Expression leOrNull(Property property, T value) { return Expr.factory().leOrNull(property.toString(), value); } - public static Expression leOrNull(Property property, java.util.Date value) { - return Expr.factory().leOrNull(property.toString(), value); - } - public static Expression inRange(Property property, T lowValue, T highValue) { return Expr.factory().inRange(property.toString(), lowValue, highValue); } - public static Expression inRange(Property property, java.util.Date lowValue, java.util.Date highValue) { - return Expr.factory().inRange(property.toString(), lowValue, highValue); - } - public static Expression inRange(Property lowProperty, Property highProperty, T value) { return Expr.factory().inRangeWith(lowProperty.toString(), highProperty.toString(), value); } - public static Expression inRange(Property lowProperty, Property highProperty, java.util.Date value) { - return Expr.factory().inRangeWith(lowProperty.toString(), highProperty.toString(), value); - } - public static Expression inRange(Property lowProperty, Property property, Property highProperty) { return Expr.factory().inRangeWithProperties(lowProperty.toString(), property.toString(), highProperty.toString()); } diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseCompareable.java b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseComparable.java similarity index 87% rename from ebean-querybean/src/main/java/io/ebean/typequery/PBaseCompareable.java rename to ebean-querybean/src/main/java/io/ebean/typequery/PBaseComparable.java index 1faa6d7aa..5a31eded7 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseCompareable.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseComparable.java @@ -6,11 +6,10 @@ import io.ebean.Query; /** * Base property for all comparable types. * - * @param the root query bean type - * @param the type of the scalar property - * @param the base type of the property + * @param the root query bean type + * @param the type of the scalar property */ -public abstract class PBaseCompareable extends PBaseValueEqual { +public abstract class PBaseComparable extends PBaseValueEqual { /** * Construct with a property name and root instance. @@ -18,14 +17,14 @@ public abstract class PBaseCompareable extends PBaseValueEqual extends PBaseValueEqual other) { - expr().raw(_name + " > " + other.propertyName()); + public final R gt(Query.Property other) { + expr().raw(_name + " > " + other.toString()); return _root; } @@ -84,8 +82,8 @@ public abstract class PBaseCompareable extends PBaseValueEqual other) { - expr().raw(_name + " >= " + other.propertyName()); + public final R ge(Query.Property other) { + expr().raw(_name + " >= " + other.toString()); return _root; } @@ -117,8 +115,8 @@ public abstract class PBaseCompareable extends PBaseValueEqual other) { - expr().raw(_name + " < " + other.propertyName()); + public final R lt(Query.Property other) { + expr().raw(_name + " < " + other.toString()); return _root; } @@ -150,8 +148,8 @@ public abstract class PBaseCompareable extends PBaseValueEqual other) { - expr().raw(_name + " <= " + other.propertyName()); + public final R le(Query.Property other) { + expr().raw(_name + " <= " + other.toString()); return _root; } @@ -200,8 +198,8 @@ public abstract class PBaseCompareable extends PBaseValueEqual highProperty, T value) { - expr().inRangeWith(_name, highProperty._name, value); + public final R inRangeWith(Query.Property highProperty, T value) { + expr().inRangeWith(_name, highProperty.toString(), value); return _root; } @@ -223,8 +221,8 @@ public abstract class PBaseCompareable extends PBaseValueEqual * This is a convenience expression combining a number of simple expressions. */ - public final R inRangeWith(TQProperty lowProperty, TQProperty highProperty) { - expr().inRangeWithProperties(_name, lowProperty.propertyName(), highProperty.propertyName()); + public final R inRangeWith(Query.Property lowProperty, Query.Property highProperty) { + expr().inRangeWithProperties(_name, lowProperty.toString(), highProperty.toString()); return _root; } diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseDate.java b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseDate.java index 8759baa7b..9fd3baa9d 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseDate.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseDate.java @@ -1,15 +1,13 @@ package io.ebean.typequery; -import java.time.temporal.Temporal; - /** * Base property for date and date time types. * * @param the root query bean type - * @param the date time type + * @param the scalar type */ @SuppressWarnings("rawtypes") -public abstract class PBaseDate extends PBaseCompareable { +public abstract class PBaseDate extends PBaseComparable { /** * Construct with a property name and root instance. @@ -34,7 +32,7 @@ public abstract class PBaseDate extends PBaseCompareabl * @param value the equal to bind value * @return the root query bean instance */ - public final R after(D value) { + public final R after(T value) { expr().gt(_name, value); return _root; } @@ -45,7 +43,7 @@ public abstract class PBaseDate extends PBaseCompareabl * @param value the equal to bind value * @return the root query bean instance */ - public final R before(D value) { + public final R before(T value) { expr().lt(_name, value); return _root; } diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseNumber.java b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseNumber.java index 140998bc9..03b3d37ea 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseNumber.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseNumber.java @@ -4,10 +4,10 @@ package io.ebean.typequery; * Base property for number types. * * @param the root query bean type - * @param the number type + * @param the property type */ @SuppressWarnings("rawtypes") -public abstract class PBaseNumber extends PBaseCompareable { +public abstract class PBaseNumber extends PBaseComparable { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseString.java b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseString.java index fb65af6ad..aaf62c6bb 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseString.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseString.java @@ -5,7 +5,7 @@ package io.ebean.typequery; * * @param the root query bean type */ -public abstract class PBaseString extends PBaseCompareable { +public abstract class PBaseString extends PBaseComparable { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseTime.java b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseTime.java index 54daaae41..f338ed2f1 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseTime.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseTime.java @@ -1,7 +1,5 @@ package io.ebean.typequery; -import java.time.temporal.Temporal; - /** * Base property for time types. * @@ -9,7 +7,7 @@ import java.time.temporal.Temporal; * @param the number type */ @SuppressWarnings("rawtypes") -public abstract class PBaseTime extends PBaseCompareable { +public abstract class PBaseTime extends PBaseComparable { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseValueEqual.java b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseValueEqual.java index 049ecac26..1f25c916e 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseValueEqual.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseValueEqual.java @@ -11,7 +11,7 @@ import java.util.Collection; * @param the root query bean type * @param the number type */ -public abstract class PBaseValueEqual extends TQPropertyBase { +public abstract class PBaseValueEqual extends TQPropertyBase { /** * Construct with a property name and root instance. @@ -89,8 +89,8 @@ public abstract class PBaseValueEqual extends TQPropertyBase { * @param other the other property to compare * @return the root query bean instance */ - public final R eq(TQProperty other) { - expr().raw(_name + " = " + other.propertyName()); + public final R eq(Query.Property other) { + expr().raw(_name + " = " + other.toString()); return _root; } @@ -152,8 +152,8 @@ public abstract class PBaseValueEqual extends TQPropertyBase { * @param other the other property to compare * @return the root query bean instance */ - public final R ne(TQProperty other) { - expr().raw(_name + " <> " + other.propertyName()); + public final R ne(Query.Property other) { + expr().raw(_name + " <> " + other.toString()); return _root; } diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PBoolean.java b/ebean-querybean/src/main/java/io/ebean/typequery/PBoolean.java index 370cce8a7..55707300e 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PBoolean.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PBoolean.java @@ -5,7 +5,7 @@ package io.ebean.typequery; * * @param the root query bean type */ -public final class PBoolean extends PBaseValueEqual { +public final class PBoolean extends PBaseValueEqual { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PByteArray.java b/ebean-querybean/src/main/java/io/ebean/typequery/PByteArray.java index ce275eeda..a94f8bbc1 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PByteArray.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PByteArray.java @@ -5,7 +5,7 @@ package io.ebean.typequery; * * @param the root query bean type */ -public final class PByteArray extends PBaseValueEqual { +public final class PByteArray extends PBaseValueEqual { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PCalendar.java b/ebean-querybean/src/main/java/io/ebean/typequery/PCalendar.java index b64ae4f2c..7aa9d9f3f 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PCalendar.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PCalendar.java @@ -7,7 +7,7 @@ import java.util.Calendar; * * @param the root query bean type */ -public final class PCalendar extends PBaseDate { +public final class PCalendar extends PBaseDate { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PEnum.java b/ebean-querybean/src/main/java/io/ebean/typequery/PEnum.java index d70ffb3e5..1659591b0 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PEnum.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PEnum.java @@ -6,7 +6,7 @@ package io.ebean.typequery; * @param the enum specific type * @param the root query bean type */ -public final class PEnum extends PBaseValueEqual { +public final class PEnum extends PBaseValueEqual { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PInstant.java b/ebean-querybean/src/main/java/io/ebean/typequery/PInstant.java index 3387668e0..3a2980d44 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PInstant.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PInstant.java @@ -8,7 +8,7 @@ import java.time.Instant; * * @param the root query bean type */ -public final class PInstant extends PBaseDate { +public final class PInstant extends PBaseDate { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PJodaDateMidnight.java b/ebean-querybean/src/main/java/io/ebean/typequery/PJodaDateMidnight.java index c6f7051e0..a9f63dc7f 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PJodaDateMidnight.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PJodaDateMidnight.java @@ -7,7 +7,7 @@ import org.joda.time.DateMidnight; * * @param the root query bean type */ -public final class PJodaDateMidnight extends PBaseDate { +public final class PJodaDateMidnight extends PBaseDate { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PJodaDateTime.java b/ebean-querybean/src/main/java/io/ebean/typequery/PJodaDateTime.java index 81132e2a2..aee165038 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PJodaDateTime.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PJodaDateTime.java @@ -7,7 +7,7 @@ import org.joda.time.DateTime; * * @param the root query bean type */ -public final class PJodaDateTime extends PBaseDate { +public final class PJodaDateTime extends PBaseDate { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PJodaLocalDate.java b/ebean-querybean/src/main/java/io/ebean/typequery/PJodaLocalDate.java index e6a5f4d52..7649a6908 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PJodaLocalDate.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PJodaLocalDate.java @@ -7,7 +7,7 @@ import org.joda.time.LocalDate; * * @param the root query bean type */ -public final class PJodaLocalDate extends PBaseDate { +public final class PJodaLocalDate extends PBaseDate { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PJodaLocalDateTime.java b/ebean-querybean/src/main/java/io/ebean/typequery/PJodaLocalDateTime.java index bad5359e3..5a506f1b5 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PJodaLocalDateTime.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PJodaLocalDateTime.java @@ -7,7 +7,7 @@ import org.joda.time.LocalDateTime; * * @param the root query bean type */ -public final class PJodaLocalDateTime extends PBaseDate { +public final class PJodaLocalDateTime extends PBaseDate { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PJson.java b/ebean-querybean/src/main/java/io/ebean/typequery/PJson.java index 546964ed9..2c4fbf908 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PJson.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PJson.java @@ -5,15 +5,11 @@ package io.ebean.typequery; * JSON document type. *

* Type that is JSON content mapped to database types such as Postgres JSON/JSONB and otherwise Varchar,Clob and Blob. - *

*

* The expressions on this type are valid of Postgres and Oracle. - *

- * *

* The path can reference a nested property in the JSON document using dot notation - * for example "documentMeta.score" where "score" is an embedded attribute of "documentMeta" - *

* * @param the root query bean type */ @@ -92,7 +88,7 @@ public final class PJson extends TQPropertyBase { * * } * - * @param path the dot notation path in the JSON document + * @param path the dot notation path in the JSON document * @param value the equal to bind value */ public R jsonEqualTo(String path, Object value) { @@ -103,7 +99,7 @@ public final class PJson extends TQPropertyBase { /** * Not Equal to - for the given path in a JSON document. * - * @param path the nested path in the JSON document in dot notation + * @param path the nested path in the JSON document in dot notation * @param value the value used to test equality against the document path's value */ public R jsonNotEqualTo(String path, Object value) { @@ -114,7 +110,7 @@ public final class PJson extends TQPropertyBase { /** * Greater than - for the given path in a JSON document. * - * @param path the nested path in the JSON document in dot notation + * @param path the nested path in the JSON document in dot notation * @param value the value used to test against the document path's value */ public R jsonGreaterThan(String path, Object value) { @@ -125,7 +121,7 @@ public final class PJson extends TQPropertyBase { /** * Greater than or equal to - for the given path in a JSON document. * - * @param path the nested path in the JSON document in dot notation + * @param path the nested path in the JSON document in dot notation * @param value the value used to test against the document path's value */ public R jsonGreaterOrEqual(String path, Object value) { @@ -136,7 +132,7 @@ public final class PJson extends TQPropertyBase { /** * Less than - for the given path in a JSON document. * - * @param path the nested path in the JSON document in dot notation + * @param path the nested path in the JSON document in dot notation * @param value the value used to test against the document path's value */ public R jsonLessThan(String path, Object value) { @@ -147,7 +143,7 @@ public final class PJson extends TQPropertyBase { /** * Less than or equal to - for the given path in a JSON document. * - * @param path the nested path in the JSON document in dot notation + * @param path the nested path in the JSON document in dot notation * @param value the value used to test against the document path's value */ public R jsonLessOrEqualTo(String path, Object value) { diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PLocalDate.java b/ebean-querybean/src/main/java/io/ebean/typequery/PLocalDate.java index 189b76eba..12e49070c 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PLocalDate.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PLocalDate.java @@ -7,7 +7,7 @@ import java.time.LocalDate; * * @param the root query bean type */ -public final class PLocalDate extends PBaseDate { +public final class PLocalDate extends PBaseDate { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PLocalDateTime.java b/ebean-querybean/src/main/java/io/ebean/typequery/PLocalDateTime.java index feb74e659..59c7ecb61 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PLocalDateTime.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PLocalDateTime.java @@ -7,7 +7,7 @@ import java.time.LocalDateTime; * * @param the root query bean type */ -public final class PLocalDateTime extends PBaseDate { +public final class PLocalDateTime extends PBaseDate { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PMonth.java b/ebean-querybean/src/main/java/io/ebean/typequery/PMonth.java index 0d127d7e7..f3b0ea4f8 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PMonth.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PMonth.java @@ -7,7 +7,7 @@ import java.time.Month; * * @param the root query bean type */ -public final class PMonth extends PBaseDate { +public final class PMonth extends PBaseDate { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PMonthDay.java b/ebean-querybean/src/main/java/io/ebean/typequery/PMonthDay.java index 27b133f47..16c41f349 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PMonthDay.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PMonthDay.java @@ -7,7 +7,7 @@ import java.time.MonthDay; * * @param the root query bean type */ -public final class PMonthDay extends PBaseDate { +public final class PMonthDay extends PBaseDate { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/POffsetDateTime.java b/ebean-querybean/src/main/java/io/ebean/typequery/POffsetDateTime.java index 88ef6875f..f1d06da4a 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/POffsetDateTime.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/POffsetDateTime.java @@ -7,7 +7,7 @@ import java.time.OffsetDateTime; * * @param the root query bean type */ -public final class POffsetDateTime extends PBaseDate { +public final class POffsetDateTime extends PBaseDate { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PScalar.java b/ebean-querybean/src/main/java/io/ebean/typequery/PScalar.java index 6318a1b8a..390923fd0 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PScalar.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PScalar.java @@ -6,7 +6,7 @@ package io.ebean.typequery; * @param the root query bean type * @param the scalar type */ -public final class PScalar extends PBaseValueEqual { +public final class PScalar extends PBaseValueEqual { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PScalarComparable.java b/ebean-querybean/src/main/java/io/ebean/typequery/PScalarComparable.java index a303e6530..38fc6947a 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PScalarComparable.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PScalarComparable.java @@ -8,7 +8,7 @@ package io.ebean.typequery; * @param the root query bean type * @param the scalar type */ -public final class PScalarComparable> extends PBaseCompareable { +public final class PScalarComparable> extends PBaseComparable { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PSqlDate.java b/ebean-querybean/src/main/java/io/ebean/typequery/PSqlDate.java index a935c9212..f69cfb236 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PSqlDate.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PSqlDate.java @@ -7,7 +7,7 @@ import java.sql.Date; * * @param the root query bean type */ -public final class PSqlDate extends PBaseDate { +public final class PSqlDate extends PBaseDate { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PString.java b/ebean-querybean/src/main/java/io/ebean/typequery/PString.java index a24cf1a9b..5903ae827 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PString.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PString.java @@ -5,7 +5,7 @@ package io.ebean.typequery; * * @param the root query bean type */ -public final class PString extends PBaseCompareable { +public final class PString extends PBaseComparable { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PTimestamp.java b/ebean-querybean/src/main/java/io/ebean/typequery/PTimestamp.java index ace329987..319425f93 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PTimestamp.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PTimestamp.java @@ -7,7 +7,7 @@ import java.sql.Timestamp; * * @param the root query bean type */ -public final class PTimestamp extends PBaseDate { +public final class PTimestamp extends PBaseDate { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PUtilDate.java b/ebean-querybean/src/main/java/io/ebean/typequery/PUtilDate.java index 49c410465..1e6f483cb 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PUtilDate.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PUtilDate.java @@ -7,7 +7,7 @@ import java.util.Date; * * @param the root query bean type */ -public final class PUtilDate extends PBaseDate { +public final class PUtilDate extends PBaseDate { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PUuid.java b/ebean-querybean/src/main/java/io/ebean/typequery/PUuid.java index ddf7366f2..e0f4e0d85 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PUuid.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PUuid.java @@ -7,7 +7,7 @@ import java.util.UUID; * * @param the root query bean type */ -public final class PUuid extends PBaseValueEqual { +public final class PUuid extends PBaseValueEqual { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PYearMonth.java b/ebean-querybean/src/main/java/io/ebean/typequery/PYearMonth.java index 77a34d70b..7f4196a59 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PYearMonth.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PYearMonth.java @@ -7,7 +7,7 @@ import java.time.YearMonth; * * @param the root query bean type */ -public final class PYearMonth extends PBaseDate { +public final class PYearMonth extends PBaseDate { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/TQProperty.java b/ebean-querybean/src/main/java/io/ebean/typequery/TQProperty.java index 79c4a2cc5..8fbb9c5dc 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/TQProperty.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/TQProperty.java @@ -6,10 +6,10 @@ import io.ebean.Query; /** * A property used in type query. * - * @param The type of the owning root bean - * @param The base type, one of String, Number, Temporal, Boolean, Object. + * @param The type of the owning root bean + * @param The property type */ -public class TQProperty implements Query.Property { +public class TQProperty implements Query.Property { protected final String _name; protected final R _root; diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/TQPropertyBase.java b/ebean-querybean/src/main/java/io/ebean/typequery/TQPropertyBase.java index 2a3937be4..e6123fa15 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/TQPropertyBase.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/TQPropertyBase.java @@ -3,10 +3,10 @@ package io.ebean.typequery; /** * Base scalar property. * - * @param The type of the owning root bean - * @param The base type of the property + * @param The type of the owning root bean + * @param The property type */ -public abstract class TQPropertyBase extends TQProperty { +public abstract class TQPropertyBase extends TQProperty { /** * Construct with a property name and root instance. diff --git a/ebean-querybean/src/test/java/org/example/domain/Country.java b/ebean-querybean/src/test/java/org/example/domain/Country.java index 30a826e00..07b5dace5 100644 --- a/ebean-querybean/src/test/java/org/example/domain/Country.java +++ b/ebean-querybean/src/test/java/org/example/domain/Country.java @@ -3,20 +3,21 @@ package org.example.domain; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; +import java.time.Instant; +import java.time.OffsetDateTime; /** * Country entity bean. */ @Entity -@Table(name="o_country") +@Table(name = "o_country") public class Country { - @Id - //@Size(max=2) - String code; - - //@Size(max=60) - String name; + @Id + String code; + String name; + Instant whenCreated; + OffsetDateTime offsetTimestamp; public Country(String code, String name) { this.code = code; @@ -24,36 +25,36 @@ public class Country { } public String toString() { - return code; - } + return code; + } - /** - * Return code. - */ - public String getCode() { - return code; - } + /** + * Return code. + */ + public String getCode() { + return code; + } - /** - * Set code. - */ - public void setCode(String code) { - this.code = code; - } + /** + * Set code. + */ + public void setCode(String code) { + this.code = code; + } - /** - * Return name. - */ - public String getName() { - return name; - } + /** + * Return name. + */ + public String getName() { + return name; + } - /** - * Set name. - */ - public void setName(String name) { - this.name = name; - } + /** + * Set name. + */ + public void setName(String name) { + this.name = name; + } } diff --git a/ebean-querybean/src/test/java/org/querytest/QCustomerTest.java b/ebean-querybean/src/test/java/org/querytest/QCustomerTest.java index 8808df5d8..e93488d37 100644 --- a/ebean-querybean/src/test/java/org/querytest/QCustomerTest.java +++ b/ebean-querybean/src/test/java/org/querytest/QCustomerTest.java @@ -456,7 +456,7 @@ public class QCustomerTest { assertContains(new QCustomer().registered.lt(new Date()).query(), " where t0.registered < ?"); assertContains(new QCustomer().registered.before(new Date()).query(), " where t0.registered < ?"); assertContains(new QCustomer().registered.lessThan(new Date()).query(), " where t0.registered < ?"); - assertContains(new QCustomer().registered.lt(QCustomer.Alias.whenUpdated).query(), " where t0.registered < t0.when_updated"); + assertContains(new QCustomer().whenCreated.lt(QCustomer.Alias.whenUpdated).query(), " where t0.when_created < t0.when_updated"); } @Test @@ -464,7 +464,7 @@ public class QCustomerTest { assertContains(new QCustomer().registered.le(new Date()).query(), " where t0.registered <= ?"); assertContains(new QCustomer().registered.lessOrEqualTo(new Date()).query(), " where t0.registered <= ?"); - assertContains(new QCustomer().registered.le(QCustomer.Alias.whenUpdated).query(), " where t0.registered <= t0.when_updated"); + assertContains(new QCustomer().whenCreated.le(QCustomer.Alias.whenUpdated).query(), " where t0.when_created <= t0.when_updated"); } @Test @@ -472,7 +472,7 @@ public class QCustomerTest { assertContains(new QCustomer().registered.after(new Date()).query(), " where t0.registered > ?"); assertContains(new QCustomer().registered.gt(new Date()).query(), " where t0.registered > ?"); - assertContains(new QCustomer().registered.gt(QCustomer.Alias.whenUpdated).query(), " where t0.registered > t0.when_updated"); + assertContains(new QCustomer().whenCreated.gt(QCustomer.Alias.whenUpdated).query(), " where t0.when_created > t0.when_updated"); assertContains(new QCustomer().registered.greaterThan(new Date()).query(), " where t0.registered > ?"); } @@ -482,7 +482,7 @@ public class QCustomerTest { assertContains(new QCustomer().registered.ge(new Date()).query(), " where t0.registered >= ?"); assertContains(new QCustomer().registered.greaterOrEqualTo(new Date()).query(), " where t0.registered >= ?"); - assertContains(new QCustomer().registered.ge(QCustomer.Alias.whenUpdated).query(), " where t0.registered >= t0.when_updated"); + assertContains(new QCustomer().whenCreated.ge(QCustomer.Alias.whenUpdated).query(), " where t0.when_created >= t0.when_updated"); } private void assertContains(Query query, String match) { @@ -708,7 +708,7 @@ public class QCustomerTest { new QCustomer() .add(in(QCustomer.Alias.name, List.of("foo", "bar"))) - .add(eq(QCustomer.Alias.currentInet, Inet.of("asd").toString())) + .add(eq(QCustomer.Alias.currentInet, Inet.of("127.0.0.1"))) .findList(); new QCustomer() diff --git a/ebean-querybean/src/test/java/org/querytest/QOrderTest.java b/ebean-querybean/src/test/java/org/querytest/QOrderTest.java index 16e2c47e4..935327359 100644 --- a/ebean-querybean/src/test/java/org/querytest/QOrderTest.java +++ b/ebean-querybean/src/test/java/org/querytest/QOrderTest.java @@ -364,11 +364,11 @@ public class QOrderTest { @Test void propertyCompare() { Query query = new QOrder() - .orderDate.lt(QOrder.Alias.customer.registered) + .orderDate.lt(QOrder.Alias.shipDate) // have to be the exact same type, in this case java.sql.Date .query(); query.findList(); - assertThat(query.getGeneratedSql()).contains(" from o_order t0 join be_customer t1 on t1.id = t0.customer_id where t0.order_date < t1.registered"); + assertThat(query.getGeneratedSql()).contains(" from o_order t0 where t0.order_date < t0.ship_date"); } @Test