hibernate-orm/design/type-system-mapping.adoc

72 lines
2.0 KiB
Plaintext
Raw Normal View History

= Mapping model
2020-08-25 21:17:35 -04:00
The mapping model encompasses the complete mapping of objects to/from database. It is the
model used to drive read and write operations.
[NOTE]
----
As of 6.0, only read operations are implemented to use this mapping model. Future versions will hopefully
move writing to use this mapping model as well
----
[plantuml,MasppingTypeSystem,png]
.Mapping type model (org.hibernate.metamodel.mapping)
....
@startuml
skinparam handwritten true
interface MappingType
2020-08-25 21:17:35 -04:00
interface ManagedMappingType
2020-08-25 21:17:35 -04:00
interface MappingModelExpressable
interface ValueMapping
interface BasicType
interface ModelPart
interface ModelPartContainer
2020-08-25 21:17:35 -04:00
MappingType <|-- BasicType
MappingType <|-- JdbcMapping
MappingType <|-- ManagedMappingType
MappingType <|-- CollectionMappingType
ManagedMappingType <|-- EmbeddableMappingType
ManagedMappingType <|-- EntityMappingType
MappingModelExpressable <|-- ValueMapping
MappingModelExpressable <|-- ModelPart
ValueMapping <|-- BasicType
2020-08-25 21:17:35 -04:00
ModelPart <|-- BasicValuedModelPart
ModelPart <|-- EmbeddableValuedModelPart
ModelPart <|-- EntityValuedModelPart
ModelPart <|-- AttributeMapping
ModelPart <|-- EntityIdentifierMapping
ModelPart <|-- EntityVersionMapping
ModelPart <|-- EntityDiscriminatorMapping
2020-08-25 21:17:35 -04:00
ModelPart <|-- CollectionPart
2020-08-25 21:17:35 -04:00
ModelPartContainer <|-- EntityMappingType
ModelPartContainer <|-- EmbeddableMappingType
@enduml
....
== Relationship with legacy "persister walking" SPI
`org.hibernate.metamodel.model.mapping` contract corollaries in `org.hibernate.persister.walking`:
EntityMapping::EntityDefinition
EmbeddableMapping::CompositionDefinition
AttributeMapping::AttributeDefinition
EntityIdentifierMapping::EntityIdentifierDefinition
== AllowableParameterType
`BindableType` is a contract that defines types that are valid for parameter binding in terms of an SQM query.
AT some point this needs to be "resolved" to a ValueMapping/Type/Bindable when generating the SQL AST and executing.
One option is to have the `BindableType` be resolved first to a `SqmExpressable`
`SqmExpressableAllowableParameterType#resolveSqmExpressable`