HHH-17504 - Ongoing JPA 32 work HHH-17350 - Work on hibernate-models, XSD and JAXB HHH-16114 - Improve boot metamodel binding HHH-15996 - Develop an abstraction for Annotation in annotation processing HHH-16012 - Develop an abstraction for domain model Class refs HHH-15997 - Support for dynamic models in orm.xml HHH-15698 - Support for entity-name in mapping.xsd
This commit is contained in:
parent
6099505ad1
commit
33c6e8284b
|
@ -772,29 +772,13 @@ public class BasicValueBinder implements JdbcTypeIndicators {
|
|||
private void prepareBasicAttribute(
|
||||
String declaringClassName,
|
||||
MemberDetails attributeMember,
|
||||
TypeDetails attributeTypeDetails) {
|
||||
final Class<Object> javaTypeClass = attributeTypeDetails.determineRawClass().toJavaClass();
|
||||
|
||||
TypeDetails attributeType) {
|
||||
final Class<Object> javaTypeClass = attributeType.determineRawClass().toJavaClass();
|
||||
implicitJavaTypeAccess = ( typeConfiguration -> {
|
||||
final java.lang.reflect.Type attributeType = attributeTypeDetails.determineRawClass().toJavaClass();
|
||||
if ( attributeTypeDetails instanceof ParameterizedTypeDetails ) {
|
||||
final List<TypeDetails> arguments = attributeTypeDetails.asParameterizedType().getArguments();
|
||||
final int argumentsSize = arguments.size();
|
||||
final java.lang.reflect.Type[] argumentTypes = new java.lang.reflect.Type[argumentsSize];
|
||||
for ( int i = 0; i < argumentsSize; i++ ) {
|
||||
argumentTypes[i] = arguments.get( i ).determineRawClass().toJavaClass();
|
||||
}
|
||||
final TypeDetails owner = attributeTypeDetails.asParameterizedType().getOwner();
|
||||
final java.lang.reflect.Type ownerType;
|
||||
if ( owner != null ) {
|
||||
ownerType = owner.determineRawClass().toJavaClass();
|
||||
}
|
||||
else {
|
||||
ownerType = null;
|
||||
}
|
||||
return new ParameterizedTypeImpl( attributeType, argumentTypes, ownerType );
|
||||
if ( attributeType.getTypeKind() == TypeDetails.Kind.PARAMETERIZED_TYPE ) {
|
||||
return ParameterizedTypeImpl.from( attributeType.asParameterizedType() );
|
||||
}
|
||||
return attributeType;
|
||||
return attributeType.determineRawClass().toJavaClass();
|
||||
} );
|
||||
|
||||
//noinspection deprecation
|
||||
|
@ -817,7 +801,7 @@ public class BasicValueBinder implements JdbcTypeIndicators {
|
|||
final AnnotationUsage<Enumerated> enumeratedAnn = attributeMember.getAnnotationUsage( Enumerated.class );
|
||||
if ( enumeratedAnn != null ) {
|
||||
this.enumType = enumeratedAnn.getEnum( "value" );
|
||||
if ( canUseEnumerated( attributeTypeDetails, javaTypeClass ) ) {
|
||||
if ( canUseEnumerated( attributeType, javaTypeClass ) ) {
|
||||
if ( this.enumType == null ) {
|
||||
throw new IllegalStateException(
|
||||
"jakarta.persistence.EnumType was null on @jakarta.persistence.Enumerated " +
|
||||
|
@ -831,7 +815,7 @@ public class BasicValueBinder implements JdbcTypeIndicators {
|
|||
"Property '%s.%s' is annotated '@Enumerated' but its type '%s' is not an enum",
|
||||
declaringClassName,
|
||||
attributeMember.getName(),
|
||||
attributeTypeDetails.getName()
|
||||
attributeType.getName()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,9 +9,13 @@ package org.hibernate.type.internal;
|
|||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import org.hibernate.models.spi.ParameterizedTypeDetails;
|
||||
import org.hibernate.models.spi.TypeDetails;
|
||||
|
||||
public class ParameterizedTypeImpl implements ParameterizedType {
|
||||
|
||||
private final Type[] substTypeArgs;
|
||||
|
@ -24,6 +28,26 @@ public class ParameterizedTypeImpl implements ParameterizedType {
|
|||
this.ownerType = ownerType;
|
||||
}
|
||||
|
||||
public static ParameterizedTypeImpl from(ParameterizedTypeDetails typeDetails) {
|
||||
final java.lang.reflect.Type attributeType = typeDetails.determineRawClass().toJavaClass();
|
||||
|
||||
final List<TypeDetails> arguments = typeDetails.asParameterizedType().getArguments();
|
||||
final int argumentsSize = arguments.size();
|
||||
final java.lang.reflect.Type[] argumentTypes = new java.lang.reflect.Type[argumentsSize];
|
||||
for ( int i = 0; i < argumentsSize; i++ ) {
|
||||
argumentTypes[i] = arguments.get( i ).determineRawClass().toJavaClass();
|
||||
}
|
||||
final TypeDetails owner = typeDetails.asParameterizedType().getOwner();
|
||||
final java.lang.reflect.Type ownerType;
|
||||
if ( owner != null ) {
|
||||
ownerType = owner.determineRawClass().toJavaClass();
|
||||
}
|
||||
else {
|
||||
ownerType = null;
|
||||
}
|
||||
return new ParameterizedTypeImpl( attributeType, argumentTypes, ownerType );
|
||||
}
|
||||
|
||||
public Type[] getActualTypeArguments() {
|
||||
return substTypeArgs;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue