Package org.hibernate.query
Class TypedParameterValue<J>
- java.lang.Object
-
- org.hibernate.query.TypedParameterValue<J>
-
public final class TypedParameterValue<J> extends Object
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 tosetParameter()
.For example:
query.setParameter("stringNamedParam", new TypedParameterValue(StandardBasicTypes.STRING, null))
Here, a "null string" argument was bound to the named parameter
:stringNamedParam
.
-
-
Constructor Summary
Constructors Constructor Description TypedParameterValue(BindableType<J> type, J value)
TypedParameterValue(BasicTypeReference<J> type, J value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BindableType<J>
getType()
The specific Hibernate type to use to bind the value.BasicTypeReference<J>
getTypeReference()
The specific Hibernate type reference to use to bind the value.J
getValue()
The value to bind
-
-
-
Constructor Detail
-
TypedParameterValue
public TypedParameterValue(BindableType<J> type, J value)
-
TypedParameterValue
public TypedParameterValue(BasicTypeReference<J> type, J value)
-
-
Method Detail
-
getValue
public J getValue()
The value to bind- Returns:
- The value to be bound
-
getType
public BindableType<J> getType()
The specific Hibernate type to use to bind the value.- Returns:
- The Hibernate type to use.
-
getTypeReference
public BasicTypeReference<J> getTypeReference()
The specific Hibernate type reference to use to bind the value.- Returns:
- The Hibernate type reference to use.
-
-