Search in sources :

Example 1 with EntityVersionMappingImpl

use of org.hibernate.metamodel.mapping.internal.EntityVersionMappingImpl in project hibernate-orm by hibernate.

the class AbstractEntityPersister method generateVersionMapping.

/**
 * @param entityPersister The AbstractEntityPersister being constructed - still initializing
 * @param bootModelRootEntityDescriptor The boot-time entity descriptor for the "root entity" in the hierarchy
 * @param creationProcess The SF creation process - access to useful things
 */
protected static EntityVersionMapping generateVersionMapping(AbstractEntityPersister entityPersister, Supplier<?> templateInstanceCreator, PersistentClass bootModelRootEntityDescriptor, MappingModelCreationProcess creationProcess) {
    final Property versionProperty = bootModelRootEntityDescriptor.getVersion();
    final BasicValue bootModelVersionValue = (BasicValue) versionProperty.getValue();
    final BasicValue.Resolution<?> basicTypeResolution = bootModelVersionValue.resolve();
    final Column column = (Column) bootModelVersionValue.getColumn();
    final Dialect dialect = creationProcess.getCreationContext().getSessionFactory().getJdbcServices().getDialect();
    return new EntityVersionMappingImpl(bootModelRootEntityDescriptor.getRootClass(), templateInstanceCreator, bootModelRootEntityDescriptor.getVersion().getName(), entityPersister.getTableName(), column.getText(dialect), column.getSqlType(), column.getLength(), column.getPrecision(), column.getScale(), basicTypeResolution.getLegacyResolvedBasicType(), entityPersister, creationProcess);
}
Also used : EntityVersionMappingImpl(org.hibernate.metamodel.mapping.internal.EntityVersionMappingImpl) Column(org.hibernate.mapping.Column) Dialect(org.hibernate.dialect.Dialect) Property(org.hibernate.mapping.Property) BasicValue(org.hibernate.mapping.BasicValue)

Aggregations

Dialect (org.hibernate.dialect.Dialect)1 BasicValue (org.hibernate.mapping.BasicValue)1 Column (org.hibernate.mapping.Column)1 Property (org.hibernate.mapping.Property)1 EntityVersionMappingImpl (org.hibernate.metamodel.mapping.internal.EntityVersionMappingImpl)1