Package net.sf.basedb.core
Class AnnotationBetweenRestriction
java.lang.Object
net.sf.basedb.core.AnnotationRestriction
net.sf.basedb.core.AnnotationBetweenRestriction
- All Implemented Interfaces:
QueryElement
,Restriction
Restricts a query using annotation values between a low and high
value.
- Version:
- 2.0
- Author:
- Nicklas
- See Also:
- Last modified
- $Date: 2019-03-12 08:29:06 +0100 (tis, 12 mars 2019) $
-
Nested Class Summary
Nested classes/interfaces inherited from class net.sf.basedb.core.AnnotationRestriction
AnnotationRestriction.Options
-
Field Summary
Fields inherited from class net.sf.basedb.core.AnnotationRestriction
alias, annotationTypeId, options, valueType
-
Constructor Summary
ConstructorDescriptionAnnotationBetweenRestriction
(String alias, int annotationTypeId, Type valueType, Object lowValue, Object highValue, boolean includePrimary, boolean includeInherited) Deprecated.AnnotationBetweenRestriction
(String alias, AnnotationType annotationType, Object lowValue, Object highValue, boolean includePrimary, boolean includeInherited) Deprecated.AnnotationBetweenRestriction
(String alias, AnnotationType annotationType, Object lowValue, Object highValue, AnnotationRestriction.Options options) Create a new annotation restriction. -
Method Summary
Modifier and TypeMethodDescriptionboolean
This restriction is equal to another AnnotationBetweenRestriction if they have the same annotation type, upper and lower bound and inheritance setting.(package private) String
getRestrictionSql
(Query query, DbControl dc) Get an SQL fragment that includes the actual restriction.int
hashCode()
(package private) void
setRestrictionParameters
(NativeQuery<?> query) Set the value for all parameters defined in the SQL fragment returned byAnnotationRestriction.getRestrictionSql(Query, DbControl)
.toString()
Methods inherited from class net.sf.basedb.core.AnnotationRestriction
getChildren, maybeEquals, notAmongSelected, toQl
-
Field Details
-
lowValue
-
highValue
-
-
Constructor Details
-
AnnotationBetweenRestriction
@Deprecated public AnnotationBetweenRestriction(String alias, AnnotationType annotationType, Object lowValue, Object highValue, boolean includePrimary, boolean includeInherited) throws InvalidDataException Deprecated.- Throws:
InvalidDataException
- Since:
- 3.5
-
AnnotationBetweenRestriction
@Deprecated public AnnotationBetweenRestriction(String alias, int annotationTypeId, Type valueType, Object lowValue, Object highValue, boolean includePrimary, boolean includeInherited) throws InvalidDataException Deprecated.- Throws:
InvalidDataException
- Since:
- 3.5
-
AnnotationBetweenRestriction
public AnnotationBetweenRestriction(String alias, AnnotationType annotationType, Object lowValue, Object highValue, AnnotationRestriction.Options options) throws InvalidDataException Create a new annotation restriction.- Parameters:
alias
- The alias of a joined item where the annotations are located or null to use the root entity of the queryannotationType
- The annotation type to use in the querylowValue
- The low value to use in the query, it must be of the correct value type for the annotation as defined by the valueType propertyhighValue
- The high value to use in the query, it must be of the correct value type for the annotation as defined by the valueType propertyoptions
- Options that specify which annotations to consider when searching- Throws:
InvalidDataException
- If any of the parameters are null or not follow the rules above.- Since:
- 3.11
-
-
Method Details
-
getRestrictionSql
Description copied from class:AnnotationRestriction
Get an SQL fragment that includes the actual restriction. Use 'v.value' to access the annotation value. Avoid including literal values originating from a user, especially strings, since it may lead to security holes unless the values are checked for dangerous characters. Use a parameter placeholder instead. A parameter placeholder is a colon (:) followed by a name. Example:v.value = :theValue
ThesetRestrictionParameters
method is called to allow the subclass to set the value of the parameters specified in the SQL fragment.- Specified by:
getRestrictionSql
in classAnnotationRestriction
- Parameters:
query
- The query object we are about to execute- Returns:
- An SQL fragment, or null if no additional restriction is required
- Throws:
BaseException
- See Also:
-
setRestrictionParameters
Description copied from class:AnnotationRestriction
Set the value for all parameters defined in the SQL fragment returned byAnnotationRestriction.getRestrictionSql(Query, DbControl)
.- Specified by:
setRestrictionParameters
in classAnnotationRestriction
- Parameters:
query
- The HibernateSQLQuery
object which is used to query the database
-
equals
This restriction is equal to another AnnotationBetweenRestriction if they have the same annotation type, upper and lower bound and inheritance setting. -
hashCode
public int hashCode()- Overrides:
hashCode
in classAnnotationRestriction
-
toString
-
AnnotationBetweenRestriction(String, AnnotationType, Object, Object, AnnotationRestriction.Options)
instead