HHH-15201 Composite ID with dynamic-map entities fails with an exception
This commit is contained in:
parent
03410ac24e
commit
aa6bb1481c
|
@ -8,6 +8,8 @@ package org.hibernate.metamodel.mapping;
|
||||||
|
|
||||||
import org.hibernate.engine.spi.IdentifierValue;
|
import org.hibernate.engine.spi.IdentifierValue;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes the mapping of an entity's identifier.
|
* Describes the mapping of an entity's identifier.
|
||||||
|
@ -41,7 +43,15 @@ public interface EntityIdentifierMapping extends ValueMapping, ModelPart {
|
||||||
|
|
||||||
Object getIdentifier(Object entity);
|
Object getIdentifier(Object entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use {@link #setIdentifier(Object, Object, EntityPersister, SharedSessionContractImplementor)} instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session);
|
void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session);
|
||||||
|
|
||||||
|
default void setIdentifier(Object entity, Object id, EntityPersister entityDescriptor, SharedSessionContractImplementor session){
|
||||||
|
setIdentifier( entity, id, session );
|
||||||
|
}
|
||||||
|
|
||||||
Object instantiate();
|
Object instantiate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,12 +236,16 @@ public class InverseNonAggregatedIdentifierMapping extends EmbeddedAttributeMapp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session) {
|
public void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session) {
|
||||||
final List<AttributeMapping> mappedIdAttributeMappings = identifierValueMapper.getAttributeMappings();
|
final EntityPersister entityDescriptor = session.getFactory().getRuntimeMetamodels()
|
||||||
final Object[] propertyValues = new Object[mappedIdAttributeMappings.size()];
|
|
||||||
final SessionFactoryImplementor factory = session.getFactory();
|
|
||||||
final EntityPersister entityDescriptor = factory.getRuntimeMetamodels()
|
|
||||||
.getMappingMetamodel()
|
.getMappingMetamodel()
|
||||||
.getEntityDescriptor( entity.getClass() );
|
.getEntityDescriptor( entity.getClass() );
|
||||||
|
setIdentifier( entity, id, entityDescriptor, session );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setIdentifier(Object entity, Object id, EntityPersister entityDescriptor, SharedSessionContractImplementor session) {
|
||||||
|
final List<AttributeMapping> mappedIdAttributeMappings = identifierValueMapper.getAttributeMappings();
|
||||||
|
final Object[] propertyValues = new Object[mappedIdAttributeMappings.size()];
|
||||||
|
|
||||||
getEmbeddableTypeDescriptor().forEachAttributeMapping(
|
getEmbeddableTypeDescriptor().forEachAttributeMapping(
|
||||||
(position, attribute) -> {
|
(position, attribute) -> {
|
||||||
|
|
|
@ -256,12 +256,16 @@ public class NonAggregatedIdentifierMappingImpl extends AbstractCompositeIdentif
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session) {
|
public void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session) {
|
||||||
final List<AttributeMapping> mappedIdAttributeMappings = identifierValueMapper.getAttributeMappings();
|
final EntityPersister entityDescriptor = session.getFactory().getRuntimeMetamodels()
|
||||||
final Object[] propertyValues = new Object[mappedIdAttributeMappings.size()];
|
|
||||||
final SessionFactoryImplementor factory = session.getFactory();
|
|
||||||
final EntityPersister entityDescriptor = factory.getRuntimeMetamodels()
|
|
||||||
.getMappingMetamodel()
|
.getMappingMetamodel()
|
||||||
.getEntityDescriptor( entity.getClass() );
|
.getEntityDescriptor( entity.getClass() );
|
||||||
|
setIdentifier( entity, id, entityDescriptor, session );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setIdentifier(Object entity, Object id, EntityPersister entityDescriptor, SharedSessionContractImplementor session) {
|
||||||
|
final List<AttributeMapping> mappedIdAttributeMappings = identifierValueMapper.getAttributeMappings();
|
||||||
|
final Object[] propertyValues = new Object[mappedIdAttributeMappings.size()];
|
||||||
|
|
||||||
getEmbeddableTypeDescriptor().forEachAttributeMapping(
|
getEmbeddableTypeDescriptor().forEachAttributeMapping(
|
||||||
(position, attribute) -> {
|
(position, attribute) -> {
|
||||||
|
|
|
@ -5191,7 +5191,7 @@ public abstract class AbstractEntityPersister
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session) {
|
public void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session) {
|
||||||
identifierMapping.setIdentifier( entity, id, session );
|
identifierMapping.setIdentifier( entity, id, this, session );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue