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 to setParameter().

For example:

 query.setParameter("stringNamedParam",
         new TypedParameterValue(StandardBasicTypes.STRING, null))
 

Here, a "null string" argument was bound to the named parameter :stringNamedParam.

Since:
6
See Also:
  • Constructor Details

  • Method Details

    • 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.