Fix some wrong assignability checks

This commit is contained in:
Christian Beikov 2021-12-16 12:10:39 +01:00 committed by Andrea Boriero
parent f765eb4a87
commit 9d75e6d620
2 changed files with 7 additions and 10 deletions

View File

@ -62,10 +62,10 @@ public class FunctionReturnImpl implements FunctionReturnImplementor {
final TypeConfiguration typeConfiguration = persistenceContext.getFactory().getMetamodel().getTypeConfiguration();
final JdbcType sqlTypeDescriptor = typeConfiguration.getJdbcTypeDescriptorRegistry()
.getDescriptor( getJdbcTypeCode() );
final BasicJavaType javaTypeMapping = sqlTypeDescriptor
final BasicJavaType<?> javaTypeMapping = sqlTypeDescriptor
.getJdbcRecommendedJavaTypeMapping( null, null, typeConfiguration );
ormType = typeConfiguration.standardBasicTypeForJavaType( javaTypeMapping.getJavaType().getClass() );
parameterExtractor = new JdbcCallParameterExtractorImpl( procedureCall.getProcedureName(), null, 0, ormType );
ormType = typeConfiguration.standardBasicTypeForJavaType( javaTypeMapping.getJavaTypeClass() );
parameterExtractor = new JdbcCallParameterExtractorImpl<>( procedureCall.getProcedureName(), null, 0, ormType );
refCursorExtractor = null;
}

View File

@ -223,8 +223,6 @@ public class CircularBiDirectionalFetchImpl implements BiDirectionalFetch, Assoc
final EntityPersister entityPersister = (EntityPersister) ( (AttributeMapping) fetchable ).getMappedType();
final CollectionKey collectionKey = circ.resolveCollectionKey( rowProcessingState );
final Object key = collectionKey.getKey();
final SharedSessionContractImplementor session = rowProcessingState.getJdbcValuesSourceProcessingState()
.getSession();
final PersistenceContext persistenceContext = session.getPersistenceContext();
@ -237,7 +235,7 @@ public class CircularBiDirectionalFetchImpl implements BiDirectionalFetch, Assoc
final Object proxy = persistenceContext.getProxy( entityKey );
// it is conceivable there is a proxy, so check that first
if ( proxy == null || !( proxy.getClass()
.isAssignableFrom( javaTypeDescriptor.getJavaTypeClass().getClass() ) ) ) {
.isAssignableFrom( javaTypeDescriptor.getJavaTypeClass() ) ) ) {
// otherwise look for an initialized version
return persistenceContext.getEntity( entityKey );
}
@ -251,8 +249,7 @@ public class CircularBiDirectionalFetchImpl implements BiDirectionalFetch, Assoc
}
final Object initializedInstance = initializer.getInitializedInstance();
if ( initializedInstance instanceof HibernateProxy ) {
if ( initializedInstance.getClass()
.isAssignableFrom( javaTypeDescriptor.getJavaTypeClass().getClass() ) ) {
if ( initializedInstance.getClass().isAssignableFrom( javaTypeDescriptor.getJavaTypeClass() ) ) {
return initializedInstance;
}
initializer.initializeInstance( rowProcessingState );
@ -266,8 +263,8 @@ public class CircularBiDirectionalFetchImpl implements BiDirectionalFetch, Assoc
Object key,
SharedSessionContractImplementor session,
PersistenceContext persistenceContext) {
String uniqueKeyPropertyName = fetchable.getReferencedPropertyName();
EntityUniqueKey euk = new EntityUniqueKey(
final String uniqueKeyPropertyName = fetchable.getReferencedPropertyName();
final EntityUniqueKey euk = new EntityUniqueKey(
entityPersister.getEntityName(),
uniqueKeyPropertyName,
key,