Interface Bindable
-
- All Superinterfaces:
JdbcMappingContainer
- All Known Subinterfaces:
AdjustableBasicType<J>
,AggregatedIdentifierMapping
,Association
,AttributeMapping
,BasicEntityIdentifierMapping
,BasicPluralType<C,E>
,BasicType<T>
,BasicValuedMapping
,BasicValuedModelPart
,CollectionIdentifierDescriptor
,CollectionPart
,CompositeIdentifierMapping
,ConvertedBasicType<J>
,DatabaseSnapshotContributor
,DeprecatedEntityStuff
,DiscriminatedAssociationModelPart
,DiscriminatorMapping
,DiscriminatorType<O>
,EmbeddableMappingType
,EmbeddableValuedFetchable
,EmbeddableValuedModelPart
,EntityAssociationMapping
,EntityCollectionPart
,EntityDiscriminatorMapping
,EntityIdentifierMapping
,EntityMappingType
,EntityPersister
,EntityRowIdMapping
,EntityValuedFetchable
,EntityValuedModelPart
,EntityVersionMapping
,Fetchable
,FetchableContainer
,ForeignKeyDescriptor
,InFlightEntityMappingType
,Loadable
,Loadable
,Lockable
,ManagedMappingType
,MappingModelExpressible<T>
,ModelPart
,ModelPartContainer
,NaturalIdMapping
,NonAggregatedIdentifierMapping
,NonAggregatedIdentifierMapping.IdentifierValueMapper
,OuterJoinLoadable
,OwnedValuedModelPart
,PluralAttributeMapping
,PostInsertIdentityPersister
,Queryable
,RootTableGroupProducer
,SingleAttributeIdentifierMapping
,SingularAttributeMapping
,SQLLoadable
,TableGroupJoinProducer
,TableGroupProducer
,UniqueKeyLoadable
,ValuedModelPart
,ValueMapping
,VirtualModelPart
- All Known Implementing Classes:
AbstractAttributeMapping
,AbstractCompositeIdentifierMapping
,AbstractDiscriminatorMapping
,AbstractEmbeddableMapping
,AbstractEntityCollectionPart
,AbstractEntityPersister
,AbstractJdbcParameter
,AbstractNaturalIdMapping
,AbstractSingleColumnStandardBasicType
,AbstractSingularAttributeMapping
,AbstractStandardBasicType
,AbstractStateArrayContributorMapping
,AnonymousTupleBasicEntityIdentifierMapping
,AnonymousTupleBasicValuedModelPart
,AnonymousTupleEmbeddableValuedModelPart
,AnonymousTupleEmbeddedEntityIdentifierMapping
,AnonymousTupleEntityValuedModelPart
,AnonymousTupleNonAggregatedEntityIdentifierMapping
,AnonymousTupleTableGroupProducer
,AnyDiscriminatorPart
,AnyKeyPart
,ArrayTupleType
,BasicArrayType
,BasicAttributeMapping
,BasicCollectionType
,BasicEntityIdentifierMappingImpl
,BasicTypeImpl
,BasicValuedCollectionPart
,BottomType
,CaseStatementDiscriminatorMappingImpl
,CollectionIdentifierDescriptorImpl
,ColumnValueParameter
,CompoundNaturalIdMapping
,ConvertedBasicArrayType
,ConvertedBasicCollectionType
,ConvertedBasicTypeImpl
,CteTupleTableGroupProducer
,CustomMutabilityConvertedBasicTypeImpl
,CustomType
,DiscriminatedAssociationAttributeMapping
,DiscriminatedCollectionPart
,DiscriminatorType
,DiscriminatorTypeImpl
,EmbeddableMappingTypeImpl
,EmbeddedAttributeMapping
,EmbeddedCollectionPart
,EmbeddedForeignKeyDescriptor
,EmbeddedIdentifierMappingImpl
,EntityRowIdMappingImpl
,EntityTypeLiteral
,EntityVersionMappingImpl
,ExplicitColumnDiscriminatorMappingImpl
,IdClassEmbeddable
,ImmutableNamedBasicTypeImpl
,InverseNonAggregatedIdentifierMapping
,JavaObjectType
,JdbcLiteral
,JdbcParameterImpl
,JoinedSubclassEntityPersister
,ManyToManyCollectionPart
,MockEntityPersister
,NamedBasicTypeImpl
,NonAggregatedIdentifierMappingImpl
,NullType
,OneToManyCollectionPart
,PluralAttributeMappingImpl
,ProcessorSessionFactory.EntityPersister
,SerializableToBlobType
,SerializableType
,SimpleForeignKeyDescriptor
,SimpleNaturalIdMapping
,SingleTableEntityPersister
,SqlTypedMappingJdbcParameter
,StandardBasicTypeTemplate
,ToOneAttributeMapping
,TupleMappingModelExpressible
,UnionSubclassEntityPersister
,VersionTypeSeedParameterSpecification
,VirtualEmbeddedAttributeMapping
,VirtualIdEmbeddable
@Incubating public interface Bindable extends JdbcMappingContainer
Contract for things at the domain mapping level that can be bound into a JDBCPreparedStatement
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Bindable.JdbcValuesBiConsumer<X,Y>
Functional interface for consuming the JDBC values, along with two values of typeX
andY
.static interface
Bindable.JdbcValuesConsumer
Functional interface for consuming the JDBC values.
-
Method Summary
-
Methods inherited from interface org.hibernate.metamodel.mapping.JdbcMappingContainer
forEachJdbcType, getJdbcMapping, getSingleJdbcMapping
-
-
-
-
Method Detail
-
getJdbcTypeCount
default int getJdbcTypeCount()
The number of JDBC mappings- Specified by:
getJdbcTypeCount
in interfaceJdbcMappingContainer
-
forEachJdbcType
default int forEachJdbcType(IndexedConsumer<JdbcMapping> action)
Visit each of JdbcMapping- Specified by:
forEachJdbcType
in interfaceJdbcMappingContainer
- API Note:
- Same as
JdbcMappingContainer.forEachJdbcType(int, IndexedConsumer)
starting from `0`
-
disassemble
Object disassemble(Object value, SharedSessionContractImplementor session)
Breaks down a value ofJ
into its simple pieces. E.g., an embedded value gets broken down into an array of its attribute state; a basic value converts to itself; etc.Generally speaking, this is the form in which entity state is kept relative to a Session via
EntityEntry
.@Entity class Person { @Id Integer id; @Embedded Name name; int age; } @Embeddable class Name { String familiarName; String familyName; }
At the top level, we would want to disassemble a
Person
value, so we'd ask theBindable
for thePerson
entity to disassemble. Given aPerson
value:Person( id=1, name=Name( 'Steve', 'Ebersole' ), 28 )
this disassemble would result in a multidimensional array:
[ ["Steve", "Ebersole"], 28 ]
Note that the identifier is not part of this disassembled state. Note also how the embedded value results in a sub-array.
- See Also:
EntityEntry
-
addToCacheKey
void addToCacheKey(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session)
Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.- Parameters:
cacheKey
- the MutableCacheKey used to add the disassembled value and the hashCodevalue
- the value to disassemblesession
- the SharedSessionContractImplementor
-
forEachDisassembledJdbcValue
default <X,Y> int forEachDisassembledJdbcValue(Object value, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> valuesConsumer, SharedSessionContractImplementor session)
Visit each constituent JDBC value over the result fromdisassemble(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor)
.Given the example in
disassemble(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor)
, this results in the consumer being called for each simple value. E.g.:consumer.consume( "Steve" ); consumer.consume( "Ebersole" ); consumer.consume( 28 );
Think of it as breaking the multidimensional array into a visitable flat array. Additionally, it passes through the values
X
andY
to the consumer.
-
forEachDisassembledJdbcValue
<X,Y> int forEachDisassembledJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> valuesConsumer, SharedSessionContractImplementor session)
LikeforEachDisassembledJdbcValue(Object, Object, Object, JdbcValuesBiConsumer, SharedSessionContractImplementor)
, but additionally receives an offset by which the selectionIndex is incremented when callingBindable.JdbcValuesBiConsumer.consume(int, Object, Object, Object, JdbcMapping)
.
-
forEachDisassembledJdbcValue
default int forEachDisassembledJdbcValue(Object value, Bindable.JdbcValuesConsumer valuesConsumer, SharedSessionContractImplementor session)
A short hand form offorEachDisassembledJdbcValue(Object, Object, Object, JdbcValuesBiConsumer, SharedSessionContractImplementor)
, that passes null for the two valuesX
andY
.
-
forEachDisassembledJdbcValue
default int forEachDisassembledJdbcValue(Object value, int offset, Bindable.JdbcValuesConsumer valuesConsumer, SharedSessionContractImplementor session)
A short hand form offorEachDisassembledJdbcValue(Object, int, Object, Object, JdbcValuesBiConsumer, SharedSessionContractImplementor)
, that passes null for the two valuesX
andY
.
-
forEachJdbcValue
default <X,Y> int forEachJdbcValue(Object value, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> valuesConsumer, SharedSessionContractImplementor session)
Visit each constituent JDBC value extracted from the entity instance itself. Short-hand form of callingdisassemble(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor)
and piping its result toforEachDisassembledJdbcValue(Object, JdbcValuesConsumer, SharedSessionContractImplementor)
-
forEachJdbcValue
default <X,Y> int forEachJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> valuesConsumer, SharedSessionContractImplementor session)
Visit each constituent JDBC value extracted from the entity instance itself. Short-hand form of callingdisassemble(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor)
and piping its result toforEachDisassembledJdbcValue(Object, int, JdbcValuesConsumer, SharedSessionContractImplementor)
-
forEachJdbcValue
default int forEachJdbcValue(Object value, Bindable.JdbcValuesConsumer valuesConsumer, SharedSessionContractImplementor session)
A short hand form offorEachJdbcValue(Object, Object, Object, JdbcValuesBiConsumer, SharedSessionContractImplementor)
, that passes null for the two valuesX
andY
.
-
forEachJdbcValue
default int forEachJdbcValue(Object value, int offset, Bindable.JdbcValuesConsumer valuesConsumer, SharedSessionContractImplementor session)
A short hand form offorEachJdbcValue(Object, int, Object, Object, JdbcValuesBiConsumer, SharedSessionContractImplementor)
, that passes null for the two valuesX
andY
.
-
-