Package org.hibernate.query
Class TypedParameterValue<J>
java.lang.Object
org.hibernate.query.TypedParameterValue<J>
Represents a typed argument to a query parameter.
Usually, the Hibernate type of
an argument to a query parameter may be inferred, and so it's rarely
necessary to explicitly pass a type when binding the argument.
Occasionally, and especially when the argument is null, the type
cannot be inferred and must be explicitly specified. In such cases,
an instance of TypedParameterValue
may be passed to
setParameter()
.
For example:
query.setParameter("stringNamedParam", new TypedParameterValue(StandardBasicTypes.STRING, null))
Here, a "null string" argument was bound to the named parameter
:stringNamedParam
.
-
Constructor Summary
ConstructorsConstructorDescriptionTypedParameterValue
(BindableType<J> type, J value) TypedParameterValue
(BasicTypeReference<J> type, J value) -
Method Summary
-
Constructor Details
-
TypedParameterValue
-
TypedParameterValue
-
-
Method Details
-
getValue
The value to bind- Returns:
- The value to be bound
-
getType
The specific Hibernate type to use to bind the value.- Returns:
- The Hibernate type to use.
-
getTypeReference
The specific Hibernate type reference to use to bind the value.- Returns:
- The Hibernate type reference to use.
-