HHH-17504 - Ongoing JPA 32 work
HHH-17460 - 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
33c6e8284b
commit
724da112e5
|
@ -57,6 +57,7 @@ import org.hibernate.jpa.spi.MutableJpaCompliance;
|
||||||
import org.hibernate.loader.BatchFetchStyle;
|
import org.hibernate.loader.BatchFetchStyle;
|
||||||
import org.hibernate.proxy.EntityNotFoundDelegate;
|
import org.hibernate.proxy.EntityNotFoundDelegate;
|
||||||
import org.hibernate.query.ImmutableEntityUpdateQueryHandlingMode;
|
import org.hibernate.query.ImmutableEntityUpdateQueryHandlingMode;
|
||||||
|
import org.hibernate.query.NullPrecedence;
|
||||||
import org.hibernate.query.criteria.ValueHandlingMode;
|
import org.hibernate.query.criteria.ValueHandlingMode;
|
||||||
import org.hibernate.query.hql.HqlTranslator;
|
import org.hibernate.query.hql.HqlTranslator;
|
||||||
import org.hibernate.query.internal.NullPrecedenceHelper;
|
import org.hibernate.query.internal.NullPrecedenceHelper;
|
||||||
|
@ -386,8 +387,11 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
||||||
this.maximumFetchDepth = getInteger( MAX_FETCH_DEPTH, configurationSettings );
|
this.maximumFetchDepth = getInteger( MAX_FETCH_DEPTH, configurationSettings );
|
||||||
|
|
||||||
final Object defaultNullPrecedence = configurationSettings.get( DEFAULT_NULL_ORDERING );
|
final Object defaultNullPrecedence = configurationSettings.get( DEFAULT_NULL_ORDERING );
|
||||||
if ( defaultNullPrecedence instanceof NullPrecedence ) {
|
if ( defaultNullPrecedence instanceof Nulls jpaValue ) {
|
||||||
this.defaultNullPrecedence = (NullPrecedence) defaultNullPrecedence;
|
this.defaultNullPrecedence = jpaValue;
|
||||||
|
}
|
||||||
|
else if ( defaultNullPrecedence instanceof NullPrecedence hibernateValue ) {
|
||||||
|
this.defaultNullPrecedence = hibernateValue.getJpaValue();
|
||||||
}
|
}
|
||||||
else if ( defaultNullPrecedence instanceof String ) {
|
else if ( defaultNullPrecedence instanceof String ) {
|
||||||
this.defaultNullPrecedence = NullPrecedenceHelper.parse( (String) defaultNullPrecedence );
|
this.defaultNullPrecedence = NullPrecedenceHelper.parse( (String) defaultNullPrecedence );
|
||||||
|
|
|
@ -6,12 +6,35 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.boot.model.internal;
|
package org.hibernate.boot.model.internal;
|
||||||
|
|
||||||
|
import java.lang.reflect.ParameterizedType;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.annotations.Parameter;
|
import org.hibernate.annotations.Parameter;
|
||||||
|
import org.hibernate.boot.model.convert.spi.ConverterDescriptor;
|
||||||
|
import org.hibernate.boot.spi.BootstrapContext;
|
||||||
|
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||||
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.models.spi.AnnotationUsage;
|
import org.hibernate.models.spi.AnnotationUsage;
|
||||||
|
import org.hibernate.resource.beans.internal.FallbackBeanInstanceProducer;
|
||||||
|
import org.hibernate.resource.beans.spi.ManagedBean;
|
||||||
|
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
|
||||||
|
import org.hibernate.type.BasicType;
|
||||||
|
import org.hibernate.type.CustomType;
|
||||||
|
import org.hibernate.type.descriptor.converter.internal.JpaAttributeConverterImpl;
|
||||||
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
|
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
|
||||||
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
|
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||||
|
import org.hibernate.type.internal.ConvertedBasicTypeImpl;
|
||||||
|
import org.hibernate.type.spi.TypeConfiguration;
|
||||||
|
import org.hibernate.usertype.UserType;
|
||||||
|
|
||||||
|
import jakarta.persistence.AttributeConverter;
|
||||||
|
|
||||||
|
import static org.hibernate.internal.util.GenericsHelper.extractClass;
|
||||||
|
import static org.hibernate.internal.util.GenericsHelper.extractParameterizedType;
|
||||||
import static org.hibernate.internal.util.collections.CollectionHelper.mapOfSize;
|
import static org.hibernate.internal.util.collections.CollectionHelper.mapOfSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,4 +48,121 @@ public class AnnotationHelper {
|
||||||
} );
|
} );
|
||||||
return paramMap;
|
return paramMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static JdbcMapping resolveUserType(Class<UserType<?>> userTypeClass, MetadataBuildingContext context) {
|
||||||
|
final BootstrapContext bootstrapContext = context.getBootstrapContext();
|
||||||
|
final UserType<?> userType = !context.getBuildingOptions().isAllowExtensionsInCdi()
|
||||||
|
? FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( userTypeClass )
|
||||||
|
: bootstrapContext.getServiceRegistry().requireService( ManagedBeanRegistry.class ).getBean( userTypeClass ).getBeanInstance();
|
||||||
|
return new CustomType<>( userType, bootstrapContext.getTypeConfiguration() );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JdbcMapping resolveAttributeConverter(Class<AttributeConverter<?, ?>> type, MetadataBuildingContext context) {
|
||||||
|
final BootstrapContext bootstrapContext = context.getBootstrapContext();
|
||||||
|
final ManagedBean<AttributeConverter<?, ?>> bean = bootstrapContext.getServiceRegistry()
|
||||||
|
.requireService( ManagedBeanRegistry.class )
|
||||||
|
.getBean( type );
|
||||||
|
|
||||||
|
final TypeConfiguration typeConfiguration = bootstrapContext.getTypeConfiguration();
|
||||||
|
final JavaTypeRegistry jtdRegistry = typeConfiguration.getJavaTypeRegistry();
|
||||||
|
|
||||||
|
final ParameterizedType converterParameterizedType = extractParameterizedType( bean.getBeanClass() );
|
||||||
|
final Class<?> domainJavaClass = extractClass( converterParameterizedType.getActualTypeArguments()[0] );
|
||||||
|
final Class<?> relationalJavaClass = extractClass( converterParameterizedType.getActualTypeArguments()[1] );
|
||||||
|
|
||||||
|
final JavaType<?> domainJtd = jtdRegistry.resolveDescriptor( domainJavaClass );
|
||||||
|
final JavaType<?> relationalJtd = jtdRegistry.resolveDescriptor( relationalJavaClass );
|
||||||
|
|
||||||
|
final JavaType<? extends AttributeConverter<?,?>> converterJtd =
|
||||||
|
jtdRegistry.resolveDescriptor( bean.getBeanClass() );
|
||||||
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
final JpaAttributeConverterImpl<?,?> valueConverter =
|
||||||
|
new JpaAttributeConverterImpl( bean, converterJtd, domainJtd, relationalJtd );
|
||||||
|
return new ConvertedBasicTypeImpl<>(
|
||||||
|
ConverterDescriptor.TYPE_NAME_PREFIX
|
||||||
|
+ valueConverter.getConverterJavaType().getTypeName(),
|
||||||
|
String.format(
|
||||||
|
"BasicType adapter for AttributeConverter<%s,%s>",
|
||||||
|
domainJtd.getTypeName(),
|
||||||
|
relationalJtd.getTypeName()
|
||||||
|
),
|
||||||
|
relationalJtd.getRecommendedJdbcType( typeConfiguration.getCurrentBaseSqlTypeIndicators() ),
|
||||||
|
valueConverter
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BasicType<Object> resolveBasicType(Class<?> type, MetadataBuildingContext context) {
|
||||||
|
final TypeConfiguration typeConfiguration = context.getBootstrapContext().getTypeConfiguration();
|
||||||
|
final JavaType<Object> jtd = typeConfiguration.getJavaTypeRegistry().findDescriptor( type );
|
||||||
|
if ( jtd != null ) {
|
||||||
|
final JdbcType jdbcType = jtd.getRecommendedJdbcType(
|
||||||
|
new JdbcTypeIndicators() {
|
||||||
|
@Override
|
||||||
|
public TypeConfiguration getTypeConfiguration() {
|
||||||
|
return typeConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPreferredSqlTypeCodeForBoolean() {
|
||||||
|
return context.getPreferredSqlTypeCodeForBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPreferredSqlTypeCodeForDuration() {
|
||||||
|
return context.getPreferredSqlTypeCodeForDuration();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPreferredSqlTypeCodeForUuid() {
|
||||||
|
return context.getPreferredSqlTypeCodeForUuid();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPreferredSqlTypeCodeForInstant() {
|
||||||
|
return context.getPreferredSqlTypeCodeForInstant();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPreferredSqlTypeCodeForArray() {
|
||||||
|
return context.getPreferredSqlTypeCodeForArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialect getDialect() {
|
||||||
|
return context.getMetadataCollector().getDatabase().getDialect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return typeConfiguration.getBasicTypeRegistry().resolve( jtd, jdbcType );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JdbcMapping resolveJavaType(Class<JavaType<?>> type, MetadataBuildingContext context) {
|
||||||
|
final TypeConfiguration typeConfiguration = context.getBootstrapContext().getTypeConfiguration();
|
||||||
|
final JavaType<?> jtd = getJavaType( type, context, typeConfiguration );
|
||||||
|
final JdbcType jdbcType = jtd.getRecommendedJdbcType( typeConfiguration.getCurrentBaseSqlTypeIndicators() );
|
||||||
|
return typeConfiguration.getBasicTypeRegistry().resolve( jtd, jdbcType );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JavaType<?> getJavaType(
|
||||||
|
Class<JavaType<?>> javaTypeClass,
|
||||||
|
MetadataBuildingContext context,
|
||||||
|
TypeConfiguration typeConfiguration) {
|
||||||
|
final JavaType<?> registeredJtd = typeConfiguration.getJavaTypeRegistry().findDescriptor( javaTypeClass );
|
||||||
|
if ( registeredJtd != null ) {
|
||||||
|
return registeredJtd;
|
||||||
|
}
|
||||||
|
else if ( !context.getBuildingOptions().isAllowExtensionsInCdi() ) {
|
||||||
|
return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( javaTypeClass );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return context.getBootstrapContext().getServiceRegistry()
|
||||||
|
.requireService( ManagedBeanRegistry.class )
|
||||||
|
.getBean( javaTypeClass )
|
||||||
|
.getBeanInstance();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class AnyBinder {
|
||||||
binder.setCascade( cascadeStrategy );
|
binder.setCascade( cascadeStrategy );
|
||||||
binder.setBuildingContext( context );
|
binder.setBuildingContext( context );
|
||||||
binder.setHolder( propertyHolder );
|
binder.setHolder( propertyHolder );
|
||||||
binder.setProperty( property );
|
binder.setMemberDetails( property );
|
||||||
binder.setEntityBinder( entityBinder );
|
binder.setEntityBinder( entityBinder );
|
||||||
Property prop = binder.makeProperty();
|
Property prop = binder.makeProperty();
|
||||||
prop.setOptional( optional && value.isNullable() );
|
prop.setOptional( optional && value.isNullable() );
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.boot.model.internal;
|
package org.hibernate.boot.model.internal;
|
||||||
|
|
||||||
import java.lang.reflect.ParameterizedType;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
@ -17,46 +16,47 @@ import org.hibernate.MappingException;
|
||||||
import org.hibernate.annotations.FilterDef;
|
import org.hibernate.annotations.FilterDef;
|
||||||
import org.hibernate.annotations.FilterDefs;
|
import org.hibernate.annotations.FilterDefs;
|
||||||
import org.hibernate.annotations.ParamDef;
|
import org.hibernate.annotations.ParamDef;
|
||||||
import org.hibernate.boot.model.convert.spi.ConverterDescriptor;
|
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
|
||||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||||
import org.hibernate.dialect.Dialect;
|
|
||||||
import org.hibernate.engine.spi.FilterDefinition;
|
import org.hibernate.engine.spi.FilterDefinition;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.models.spi.AnnotationTarget;
|
import org.hibernate.models.spi.AnnotationTarget;
|
||||||
import org.hibernate.models.spi.AnnotationUsage;
|
import org.hibernate.models.spi.AnnotationUsage;
|
||||||
import org.hibernate.models.spi.ClassDetails;
|
import org.hibernate.models.spi.ClassDetails;
|
||||||
import org.hibernate.resource.beans.internal.FallbackBeanInstanceProducer;
|
|
||||||
import org.hibernate.resource.beans.spi.ManagedBean;
|
|
||||||
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
|
|
||||||
import org.hibernate.type.BasicType;
|
|
||||||
import org.hibernate.type.CustomType;
|
|
||||||
import org.hibernate.type.descriptor.converter.internal.JpaAttributeConverterImpl;
|
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
|
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
|
||||||
import org.hibernate.type.internal.ConvertedBasicTypeImpl;
|
|
||||||
import org.hibernate.type.spi.TypeConfiguration;
|
|
||||||
import org.hibernate.usertype.UserType;
|
import org.hibernate.usertype.UserType;
|
||||||
|
|
||||||
import jakarta.persistence.AttributeConverter;
|
import jakarta.persistence.AttributeConverter;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import static java.util.Collections.emptyMap;
|
import static java.util.Collections.emptyMap;
|
||||||
|
import static org.hibernate.boot.model.internal.AnnotationHelper.resolveAttributeConverter;
|
||||||
|
import static org.hibernate.boot.model.internal.AnnotationHelper.resolveBasicType;
|
||||||
|
import static org.hibernate.boot.model.internal.AnnotationHelper.resolveJavaType;
|
||||||
|
import static org.hibernate.boot.model.internal.AnnotationHelper.resolveUserType;
|
||||||
import static org.hibernate.boot.model.internal.BinderHelper.getOverridableAnnotation;
|
import static org.hibernate.boot.model.internal.BinderHelper.getOverridableAnnotation;
|
||||||
import static org.hibernate.internal.CoreLogging.messageLogger;
|
import static org.hibernate.internal.CoreLogging.messageLogger;
|
||||||
import static org.hibernate.internal.util.GenericsHelper.extractClass;
|
|
||||||
import static org.hibernate.internal.util.GenericsHelper.extractParameterizedType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
class FilterDefBinder {
|
class FilterDefBinder {
|
||||||
|
|
||||||
private static final CoreMessageLogger LOG = messageLogger( FilterDefBinder.class );
|
private static final CoreMessageLogger LOG = messageLogger( FilterDefBinder.class );
|
||||||
|
|
||||||
|
public static void bindFilterDefs(AnnotationTarget annotatedElement, MetadataBuildingContext context) {
|
||||||
|
final AnnotationUsage<FilterDef> filterDef = annotatedElement.getAnnotationUsage( FilterDef.class );
|
||||||
|
final AnnotationUsage<FilterDefs> filterDefs = getOverridableAnnotation( annotatedElement, FilterDefs.class, context );
|
||||||
|
if ( filterDef != null ) {
|
||||||
|
bindFilterDef( filterDef, context );
|
||||||
|
}
|
||||||
|
if ( filterDefs != null ) {
|
||||||
|
final List<AnnotationUsage<FilterDef>> nestedDefs = filterDefs.getList( "value" );
|
||||||
|
for ( AnnotationUsage<FilterDef> def : nestedDefs ) {
|
||||||
|
bindFilterDef( def, context );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void bindFilterDef(AnnotationUsage<FilterDef> filterDef, MetadataBuildingContext context) {
|
public static void bindFilterDef(AnnotationUsage<FilterDef> filterDef, MetadataBuildingContext context) {
|
||||||
final String name = filterDef.getString( "name" );
|
final String name = filterDef.getString( "name" );
|
||||||
if ( context.getMetadataCollector().getFilterDefinition( name ) != null ) {
|
if ( context.getMetadataCollector().getFilterDefinition( name ) != null ) {
|
||||||
|
@ -134,137 +134,4 @@ class FilterDefBinder {
|
||||||
return resolveBasicType( type, context );
|
return resolveBasicType( type, context );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BasicType<Object> resolveBasicType(Class<?> type, MetadataBuildingContext context) {
|
|
||||||
final TypeConfiguration typeConfiguration = context.getBootstrapContext().getTypeConfiguration();
|
|
||||||
final JavaType<Object> jtd = typeConfiguration.getJavaTypeRegistry().findDescriptor( type );
|
|
||||||
if ( jtd != null ) {
|
|
||||||
final JdbcType jdbcType = jtd.getRecommendedJdbcType(
|
|
||||||
new JdbcTypeIndicators() {
|
|
||||||
@Override
|
|
||||||
public TypeConfiguration getTypeConfiguration() {
|
|
||||||
return typeConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPreferredSqlTypeCodeForBoolean() {
|
|
||||||
return context.getPreferredSqlTypeCodeForBoolean();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPreferredSqlTypeCodeForDuration() {
|
|
||||||
return context.getPreferredSqlTypeCodeForDuration();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPreferredSqlTypeCodeForUuid() {
|
|
||||||
return context.getPreferredSqlTypeCodeForUuid();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPreferredSqlTypeCodeForInstant() {
|
|
||||||
return context.getPreferredSqlTypeCodeForInstant();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPreferredSqlTypeCodeForArray() {
|
|
||||||
return context.getPreferredSqlTypeCodeForArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Dialect getDialect() {
|
|
||||||
return context.getMetadataCollector().getDatabase().getDialect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return typeConfiguration.getBasicTypeRegistry().resolve( jtd, jdbcType );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static JdbcMapping resolveUserType(Class<UserType<?>> userTypeClass, MetadataBuildingContext context) {
|
|
||||||
final BootstrapContext bootstrapContext = context.getBootstrapContext();
|
|
||||||
final UserType<?> userType =
|
|
||||||
!context.getBuildingOptions().isAllowExtensionsInCdi()
|
|
||||||
? FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( userTypeClass )
|
|
||||||
: bootstrapContext.getServiceRegistry().requireService( ManagedBeanRegistry.class )
|
|
||||||
.getBean( userTypeClass ).getBeanInstance();
|
|
||||||
return new CustomType<>( userType, bootstrapContext.getTypeConfiguration() );
|
|
||||||
}
|
|
||||||
|
|
||||||
private static JdbcMapping resolveAttributeConverter(Class<AttributeConverter<?, ?>> type, MetadataBuildingContext context) {
|
|
||||||
final BootstrapContext bootstrapContext = context.getBootstrapContext();
|
|
||||||
final ManagedBean<AttributeConverter<?, ?>> bean =
|
|
||||||
bootstrapContext.getServiceRegistry()
|
|
||||||
.requireService( ManagedBeanRegistry.class )
|
|
||||||
.getBean( type );
|
|
||||||
|
|
||||||
final TypeConfiguration typeConfiguration = bootstrapContext.getTypeConfiguration();
|
|
||||||
final JavaTypeRegistry jtdRegistry = typeConfiguration.getJavaTypeRegistry();
|
|
||||||
|
|
||||||
final ParameterizedType converterParameterizedType = extractParameterizedType( bean.getBeanClass() );
|
|
||||||
final Class<?> domainJavaClass = extractClass( converterParameterizedType.getActualTypeArguments()[0] );
|
|
||||||
final Class<?> relationalJavaClass = extractClass( converterParameterizedType.getActualTypeArguments()[1] );
|
|
||||||
|
|
||||||
final JavaType<?> domainJtd = jtdRegistry.resolveDescriptor( domainJavaClass );
|
|
||||||
final JavaType<?> relationalJtd = jtdRegistry.resolveDescriptor( relationalJavaClass );
|
|
||||||
|
|
||||||
final JavaType<? extends AttributeConverter<?,?>> converterJtd =
|
|
||||||
jtdRegistry.resolveDescriptor( bean.getBeanClass() );
|
|
||||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
|
||||||
final JpaAttributeConverterImpl<?,?> valueConverter =
|
|
||||||
new JpaAttributeConverterImpl( bean, converterJtd, domainJtd, relationalJtd );
|
|
||||||
return new ConvertedBasicTypeImpl<>(
|
|
||||||
ConverterDescriptor.TYPE_NAME_PREFIX
|
|
||||||
+ valueConverter.getConverterJavaType().getTypeName(),
|
|
||||||
String.format(
|
|
||||||
"BasicType adapter for AttributeConverter<%s,%s>",
|
|
||||||
domainJtd.getTypeName(),
|
|
||||||
relationalJtd.getTypeName()
|
|
||||||
),
|
|
||||||
relationalJtd.getRecommendedJdbcType( typeConfiguration.getCurrentBaseSqlTypeIndicators() ),
|
|
||||||
valueConverter
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static JdbcMapping resolveJavaType(Class<JavaType<?>> type, MetadataBuildingContext context) {
|
|
||||||
final TypeConfiguration typeConfiguration = context.getBootstrapContext().getTypeConfiguration();
|
|
||||||
final JavaType<?> jtd = getJavaType( type, context, typeConfiguration );
|
|
||||||
final JdbcType jdbcType = jtd.getRecommendedJdbcType( typeConfiguration.getCurrentBaseSqlTypeIndicators() );
|
|
||||||
return typeConfiguration.getBasicTypeRegistry().resolve( jtd, jdbcType );
|
|
||||||
}
|
|
||||||
|
|
||||||
private static JavaType<?> getJavaType(Class<JavaType<?>> javaTypeClass,
|
|
||||||
MetadataBuildingContext context,
|
|
||||||
TypeConfiguration typeConfiguration) {
|
|
||||||
final JavaType<?> registeredJtd = typeConfiguration.getJavaTypeRegistry().findDescriptor( javaTypeClass );
|
|
||||||
if ( registeredJtd != null ) {
|
|
||||||
return registeredJtd;
|
|
||||||
}
|
|
||||||
else if ( !context.getBuildingOptions().isAllowExtensionsInCdi() ) {
|
|
||||||
return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( javaTypeClass );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return context.getBootstrapContext().getServiceRegistry()
|
|
||||||
.requireService( ManagedBeanRegistry.class )
|
|
||||||
.getBean( javaTypeClass )
|
|
||||||
.getBeanInstance();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void bindFilterDefs(AnnotationTarget annotatedElement, MetadataBuildingContext context) {
|
|
||||||
final AnnotationUsage<FilterDef> filterDef = annotatedElement.getAnnotationUsage( FilterDef.class );
|
|
||||||
final AnnotationUsage<FilterDefs> filterDefs = getOverridableAnnotation( annotatedElement, FilterDefs.class, context );
|
|
||||||
if ( filterDef != null ) {
|
|
||||||
bindFilterDef( filterDef, context );
|
|
||||||
}
|
|
||||||
if ( filterDefs != null ) {
|
|
||||||
final List<AnnotationUsage<FilterDef>> nestedDefs = filterDefs.getList( "value" );
|
|
||||||
for ( AnnotationUsage<FilterDef> def : nestedDefs ) {
|
|
||||||
bindFilterDef( def, context );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,10 +44,10 @@ import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.MappedSuperclass;
|
import jakarta.persistence.MappedSuperclass;
|
||||||
|
|
||||||
import static org.hibernate.boot.jaxb.SourceType.OTHER;
|
import static org.hibernate.boot.jaxb.SourceType.OTHER;
|
||||||
import static org.hibernate.boot.model.internal.AnnotationBinder.resolveAttributeConverter;
|
import static org.hibernate.boot.model.internal.AnnotationHelper.resolveAttributeConverter;
|
||||||
import static org.hibernate.boot.model.internal.AnnotationBinder.resolveBasicType;
|
import static org.hibernate.boot.model.internal.AnnotationHelper.resolveBasicType;
|
||||||
import static org.hibernate.boot.model.internal.AnnotationBinder.resolveJavaType;
|
import static org.hibernate.boot.model.internal.AnnotationHelper.resolveJavaType;
|
||||||
import static org.hibernate.boot.model.internal.AnnotationBinder.resolveUserType;
|
import static org.hibernate.boot.model.internal.AnnotationHelper.resolveUserType;
|
||||||
import static org.hibernate.models.spi.ClassDetails.VOID_CLASS_DETAILS;
|
import static org.hibernate.models.spi.ClassDetails.VOID_CLASS_DETAILS;
|
||||||
import static org.hibernate.models.spi.ClassDetails.VOID_OBJECT_CLASS_DETAILS;
|
import static org.hibernate.models.spi.ClassDetails.VOID_OBJECT_CLASS_DETAILS;
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,7 @@ public abstract class AbstractDomainPath implements DomainPath {
|
||||||
collation,
|
collation,
|
||||||
creationState
|
creationState
|
||||||
);
|
);
|
||||||
ast.addSortSpecification( new SortSpecification( sortExpression, sortOrder, nullPrecedence ) );
|
ast.addSortSpecification( new SortSpecification( sortExpression, sortOrder, nullPrecedence.getJpaValue() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean selectClauseDoesNotContainOrderExpression(Expression expression, SelectClause selectClause) {
|
private static boolean selectClauseDoesNotContainOrderExpression(Expression expression, SelectClause selectClause) {
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class ColumnReference implements OrderingExpression, SequencePart {
|
||||||
collation,
|
collation,
|
||||||
creationState
|
creationState
|
||||||
);
|
);
|
||||||
ast.addSortSpecification( new SortSpecification( sortExpression, sortOrder, nullPrecedence ) );
|
ast.addSortSpecification( new SortSpecification( sortExpression, sortOrder, nullPrecedence.getJpaValue() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
TableReference getTableReference(TableGroup tableGroup) {
|
TableReference getTableReference(TableGroup tableGroup) {
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class FunctionExpression implements OrderingExpression, FunctionRenderer
|
||||||
collation,
|
collation,
|
||||||
creationState
|
creationState
|
||||||
);
|
);
|
||||||
ast.addSortSpecification( new SortSpecification( sortExpression, sortOrder, nullPrecedence ) );
|
ast.addSortSpecification( new SortSpecification( sortExpression, sortOrder, nullPrecedence.getJpaValue() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class SelfRenderingOrderingExpression extends SelfRenderingSqlFragmentExp
|
||||||
creationState
|
creationState
|
||||||
);
|
);
|
||||||
|
|
||||||
ast.addSortSpecification( new SortSpecification( sortExpression, sortOrder, nullPrecedence ) );
|
ast.addSortSpecification( new SortSpecification( sortExpression, sortOrder, nullPrecedence.getJpaValue() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -189,8 +189,8 @@ public interface HibernateCriteriaBuilder extends CriteriaBuilder {
|
||||||
|
|
||||||
<T> JpaSubQuery<T> union(boolean all, Subquery<? extends T> query1, Subquery<?>... queries);
|
<T> JpaSubQuery<T> union(boolean all, Subquery<? extends T> query1, Subquery<?>... queries);
|
||||||
|
|
||||||
default <T> JpaSubQuery<T> unionAll(Subquery<? extends T> query1, Subquery<?>... queries) {
|
default <T> JpaSubQuery<T> unionAll(JpaSubQuery<? extends T> query1, JpaSubQuery<? extends T> query2) {
|
||||||
return union( true, query1, queries );
|
return union( true, query1, query2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1035,15 +1035,34 @@ public interface HibernateCriteriaBuilder extends CriteriaBuilder {
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// Ordering
|
// Ordering
|
||||||
|
|
||||||
JpaOrder sort(JpaExpression<?> sortExpression, SortDirection sortOrder, NullPrecedence nullPrecedence, boolean ignoreCase);
|
|
||||||
JpaOrder sort(JpaExpression<?> sortExpression, SortDirection sortOrder, NullPrecedence nullPrecedence);
|
|
||||||
|
|
||||||
default JpaOrder sort(JpaExpression<?> sortExpression, SortDirection sortOrder, Nulls nullPrecedence) {
|
JpaOrder sort(JpaExpression<?> sortExpression);
|
||||||
return sort( sortExpression, sortOrder, NullPrecedence.fromJpaValue( nullPrecedence ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
JpaOrder sort(JpaExpression<?> sortExpression, SortDirection sortOrder);
|
JpaOrder sort(JpaExpression<?> sortExpression, SortDirection sortOrder);
|
||||||
JpaOrder sort(JpaExpression<?> sortExpression);
|
|
||||||
|
JpaOrder sort(JpaExpression<?> sortExpression, SortDirection sortOrder, Nulls nullPrecedence);
|
||||||
|
|
||||||
|
JpaOrder sort(JpaExpression<?> sortExpression, SortDirection sortOrder, Nulls nullPrecedence, boolean ignoreCase);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@linkplain #sort(JpaExpression, SortDirection, Nulls)} instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
default JpaOrder sort(JpaExpression<?> sortExpression, SortDirection sortOrder, NullPrecedence nullPrecedence) {
|
||||||
|
return sort( sortExpression, sortOrder, nullPrecedence.getJpaValue() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@linkplain #sort(JpaExpression, SortDirection, Nulls, boolean)} instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
default JpaOrder sort(
|
||||||
|
JpaExpression<?> sortExpression,
|
||||||
|
SortDirection sortOrder,
|
||||||
|
NullPrecedence nullPrecedence,
|
||||||
|
boolean ignoreCase) {
|
||||||
|
return sort( sortExpression, sortOrder, nullPrecedence.getJpaValue(), ignoreCase );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
JpaOrder asc(Expression<?> x);
|
JpaOrder asc(Expression<?> x);
|
||||||
|
|
|
@ -218,8 +218,8 @@ public class HibernateCriteriaBuilderDelegate implements HibernateCriteriaBuilde
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> JpaSubQuery<T> unionAll(Subquery<? extends T> query1, Subquery<?>... queries) {
|
public <T> JpaSubQuery<T> unionAll(JpaSubQuery<? extends T> query1, JpaSubQuery<? extends T> query2) {
|
||||||
return criteriaBuilder.unionAll( query1, queries );
|
return criteriaBuilder.unionAll( query1, query2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1305,6 +1305,20 @@ public class HibernateCriteriaBuilderDelegate implements HibernateCriteriaBuilde
|
||||||
return criteriaBuilder.sort( sortExpression, sortOrder );
|
return criteriaBuilder.sort( sortExpression, sortOrder );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JpaOrder sort(JpaExpression<?> sortExpression, SortDirection sortOrder, Nulls nullPrecedence) {
|
||||||
|
return criteriaBuilder.sort( sortExpression, sortOrder, nullPrecedence );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JpaOrder sort(
|
||||||
|
JpaExpression<?> sortExpression,
|
||||||
|
SortDirection sortOrder,
|
||||||
|
Nulls nullPrecedence,
|
||||||
|
boolean ignoreCase) {
|
||||||
|
return criteriaBuilder.sort( sortExpression, sortOrder, nullPrecedence, ignoreCase );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JpaOrder sort(JpaExpression<?> sortExpression) {
|
public JpaOrder sort(JpaExpression<?> sortExpression) {
|
||||||
return criteriaBuilder.sort( sortExpression );
|
return criteriaBuilder.sort( sortExpression );
|
||||||
|
|
|
@ -64,6 +64,7 @@ import jakarta.persistence.criteria.Expression;
|
||||||
import jakarta.persistence.criteria.Join;
|
import jakarta.persistence.criteria.Join;
|
||||||
import jakarta.persistence.criteria.ListJoin;
|
import jakarta.persistence.criteria.ListJoin;
|
||||||
import jakarta.persistence.criteria.MapJoin;
|
import jakarta.persistence.criteria.MapJoin;
|
||||||
|
import jakarta.persistence.criteria.Nulls;
|
||||||
import jakarta.persistence.criteria.Path;
|
import jakarta.persistence.criteria.Path;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
import jakarta.persistence.criteria.Root;
|
import jakarta.persistence.criteria.Root;
|
||||||
|
@ -1150,18 +1151,29 @@ public interface NodeBuilder extends HibernateCriteriaBuilder {
|
||||||
<M extends Map<?, ?>> SqmExpression<Integer> mapSize(M map);
|
<M extends Map<?, ?>> SqmExpression<Integer> mapSize(M map);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
SqmSortSpecification sort(
|
SqmSortSpecification sort(JpaExpression<?> sortExpression, SortDirection sortOrder, Nulls nullPrecedence);
|
||||||
JpaExpression<?> sortExpression,
|
|
||||||
SortDirection sortOrder,
|
|
||||||
NullPrecedence nullPrecedence);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
SqmSortSpecification sort(
|
SqmSortSpecification sort(
|
||||||
JpaExpression<?> sortExpression,
|
JpaExpression<?> sortExpression,
|
||||||
SortDirection sortOrder,
|
SortDirection sortOrder,
|
||||||
NullPrecedence nullPrecedence,
|
Nulls nullPrecedence,
|
||||||
boolean ignoreCase);
|
boolean ignoreCase);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default SqmSortSpecification sort(JpaExpression<?> sortExpression, SortDirection sortOrder, NullPrecedence nullPrecedence) {
|
||||||
|
return (SqmSortSpecification) HibernateCriteriaBuilder.super.sort( sortExpression, sortOrder, nullPrecedence );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default SqmSortSpecification sort(
|
||||||
|
JpaExpression<?> sortExpression,
|
||||||
|
SortDirection sortOrder,
|
||||||
|
NullPrecedence nullPrecedence,
|
||||||
|
boolean ignoreCase) {
|
||||||
|
return (SqmSortSpecification) HibernateCriteriaBuilder.super.sort( sortExpression, sortOrder, nullPrecedence, ignoreCase );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
SqmSortSpecification sort(JpaExpression<?> sortExpression, SortDirection sortOrder);
|
SqmSortSpecification sort(JpaExpression<?> sortExpression, SortDirection sortOrder);
|
||||||
|
|
||||||
|
|
|
@ -723,12 +723,16 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmSortSpecification sort(JpaExpression<?> sortExpression, SortDirection sortOrder, NullPrecedence nullPrecedence) {
|
public SqmSortSpecification sort(JpaExpression<?> sortExpression, SortDirection sortOrder, Nulls nullPrecedence) {
|
||||||
return new SqmSortSpecification( (SqmExpression<?>) sortExpression, sortOrder, nullPrecedence );
|
return new SqmSortSpecification( (SqmExpression<?>) sortExpression, sortOrder, nullPrecedence );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmSortSpecification sort(JpaExpression<?> sortExpression, SortDirection sortOrder, NullPrecedence nullPrecedence, boolean ignoreCase) {
|
public SqmSortSpecification sort(
|
||||||
|
JpaExpression<?> sortExpression,
|
||||||
|
SortDirection sortOrder,
|
||||||
|
Nulls nullPrecedence,
|
||||||
|
boolean ignoreCase) {
|
||||||
return new SqmSortSpecification( (SqmExpression<?>) sortExpression, sortOrder, nullPrecedence, ignoreCase );
|
return new SqmSortSpecification( (SqmExpression<?>) sortExpression, sortOrder, nullPrecedence, ignoreCase );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,9 +152,9 @@ public class SqmFromClause implements Serializable {
|
||||||
}
|
}
|
||||||
appendJoins( sqmJoin, sb );
|
appendJoins( sqmJoin, sb );
|
||||||
}
|
}
|
||||||
else if ( sqmJoin instanceof SqmCrossJoin<?> ) {
|
else if ( sqmJoin instanceof SqmCrossJoin<?> sqmCrossJoin ) {
|
||||||
sb.append( ( (SqmCrossJoin<?>) sqmJoin ).getEntityName() );
|
sb.append( sqmCrossJoin.getEntityName() );
|
||||||
sb.append( ' ' ).append( sqmJoin.resolveAlias() );
|
sb.append( ' ' ).append( sqmCrossJoin.resolveAlias() );
|
||||||
appendJoins( sqmJoin, sb );
|
appendJoins( sqmJoin, sb );
|
||||||
}
|
}
|
||||||
else if ( sqmJoin instanceof SqmEntityJoin<?, ?> sqmEntityJoin ) {
|
else if ( sqmJoin instanceof SqmEntityJoin<?, ?> sqmEntityJoin ) {
|
||||||
|
|
|
@ -345,12 +345,12 @@ public class SqmSelectStatement<T> extends AbstractSqmSelectQuery<T> implements
|
||||||
return (Selection<? extends T>) selectionList.get( 0 );
|
return (Selection<? extends T>) selectionList.get( 0 );
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
return (Selection<? extends T>) nodeBuilder().array( selectionList );
|
return (Selection<? extends T>) nodeBuilder().array( (List) selectionList );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( Tuple.class.isAssignableFrom( resultType ) ) {
|
else if ( Tuple.class.isAssignableFrom( resultType ) ) {
|
||||||
return (Selection<? extends T>) nodeBuilder().tuple( selectionList );
|
return (Selection<? extends T>) nodeBuilder().tuple( (List) selectionList );
|
||||||
}
|
}
|
||||||
else if ( resultType.isArray() ) {
|
else if ( resultType.isArray() ) {
|
||||||
return nodeBuilder().array( resultType, selections );
|
return nodeBuilder().array( resultType, selections );
|
||||||
|
@ -519,8 +519,6 @@ public class SqmSelectStatement<T> extends AbstractSqmSelectQuery<T> implements
|
||||||
query.select( nodeBuilder().count() );
|
query.select( nodeBuilder().count() );
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
querySpec.getSelectClause().setSelection( (SqmSelectableNode<?>) nodeBuilder.tuple( subSelections ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private <S> void aliasSelections(SqmQueryPart<S> queryPart) {
|
private <S> void aliasSelections(SqmQueryPart<S> queryPart) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class SqmSortSpecification implements JpaOrder {
|
||||||
public SqmSortSpecification(
|
public SqmSortSpecification(
|
||||||
SqmExpression sortExpression,
|
SqmExpression sortExpression,
|
||||||
SortDirection sortOrder,
|
SortDirection sortOrder,
|
||||||
NullPrecedence nullPrecedence,
|
Nulls nullPrecedence,
|
||||||
boolean ignoreCase) {
|
boolean ignoreCase) {
|
||||||
assert sortExpression != null;
|
assert sortExpression != null;
|
||||||
assert sortOrder != null;
|
assert sortOrder != null;
|
||||||
|
|
|
@ -61,10 +61,9 @@ import org.hibernate.persister.entity.AbstractEntityPersister;
|
||||||
import org.hibernate.persister.entity.Loadable;
|
import org.hibernate.persister.entity.Loadable;
|
||||||
import org.hibernate.persister.internal.SqlFragmentPredicate;
|
import org.hibernate.persister.internal.SqlFragmentPredicate;
|
||||||
import org.hibernate.query.IllegalQueryOperationException;
|
import org.hibernate.query.IllegalQueryOperationException;
|
||||||
import org.hibernate.query.NullPrecedence;
|
|
||||||
import org.hibernate.query.ReturnableType;
|
import org.hibernate.query.ReturnableType;
|
||||||
import org.hibernate.query.SortDirection;
|
import org.hibernate.query.SortDirection;
|
||||||
import org.hibernate.query.results.TableGroupImpl;
|
import org.hibernate.query.internal.NullPrecedenceHelper;
|
||||||
import org.hibernate.query.spi.Limit;
|
import org.hibernate.query.spi.Limit;
|
||||||
import org.hibernate.query.spi.QueryOptions;
|
import org.hibernate.query.spi.QueryOptions;
|
||||||
import org.hibernate.query.sqm.BinaryArithmeticOperator;
|
import org.hibernate.query.sqm.BinaryArithmeticOperator;
|
||||||
|
@ -3320,8 +3319,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
|
||||||
case LONG:
|
case LONG:
|
||||||
return castNumberToString( expression, 19, 0 );
|
return castNumberToString( expression, 19, 0 );
|
||||||
case FIXED:
|
case FIXED:
|
||||||
if ( expression.getExpressionType() instanceof SqlTypedMapping ) {
|
if ( expression.getExpressionType() instanceof SqlTypedMapping sqlTypedMapping ) {
|
||||||
final SqlTypedMapping sqlTypedMapping = (SqlTypedMapping) expression.getExpressionType();
|
|
||||||
if ( sqlTypedMapping.getPrecision() != null && sqlTypedMapping.getScale() != null ) {
|
if ( sqlTypedMapping.getPrecision() != null && sqlTypedMapping.getScale() != null ) {
|
||||||
return castNumberToString(
|
return castNumberToString(
|
||||||
expression,
|
expression,
|
||||||
|
@ -3946,8 +3944,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
|
||||||
if ( expression instanceof Literal ) {
|
if ( expression instanceof Literal ) {
|
||||||
appendSql( "()" );
|
appendSql( "()" );
|
||||||
}
|
}
|
||||||
else if ( expression instanceof Summarization ) {
|
else if ( expression instanceof Summarization summarization ) {
|
||||||
Summarization summarization = (Summarization) expression;
|
|
||||||
appendSql( summarization.getKind().sqlText() );
|
appendSql( summarization.getKind().sqlText() );
|
||||||
appendSql( OPEN_PARENTHESIS );
|
appendSql( OPEN_PARENTHESIS );
|
||||||
renderCommaSeparated( summarization.getGroupings() );
|
renderCommaSeparated( summarization.getGroupings() );
|
||||||
|
@ -5691,7 +5688,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
|
||||||
new SortSpecification(
|
new SortSpecification(
|
||||||
new SqlSelectionExpression( sqlSelections.get( i ) ),
|
new SqlSelectionExpression( sqlSelections.get( i ) ),
|
||||||
SortDirection.ASCENDING,
|
SortDirection.ASCENDING,
|
||||||
NullPrecedence.NONE
|
Nulls.NONE
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,16 @@ public class SortSpecification implements SqlAstNode {
|
||||||
this( sortExpression, sortOrder, Nulls.NONE, false );
|
this( sortExpression, sortOrder, Nulls.NONE, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SortSpecification(Expression sortExpression, SortDirection sortOrder, Nulls nullPrecedence) {
|
||||||
|
this( sortExpression, sortOrder, nullPrecedence, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@linkplain #SortSpecification(Expression, SortDirection, Nulls)} instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public SortSpecification(Expression sortExpression, SortDirection sortOrder, NullPrecedence nullPrecedence) {
|
public SortSpecification(Expression sortExpression, SortDirection sortOrder, NullPrecedence nullPrecedence) {
|
||||||
this( sortExpression, sortOrder, nullPrecedence.getJpaValue(), false );
|
this( sortExpression, sortOrder, nullPrecedence.getJpaValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public SortSpecification(Expression sortExpression, SortDirection sortOrder, Nulls nullPrecedence, boolean ignoreCase) {
|
public SortSpecification(Expression sortExpression, SortDirection sortOrder, Nulls nullPrecedence, boolean ignoreCase) {
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.hibernate.Session;
|
||||||
import org.hibernate.query.criteria.HibernateCriteriaBuilder;
|
import org.hibernate.query.criteria.HibernateCriteriaBuilder;
|
||||||
import org.hibernate.query.criteria.JpaCriteriaQuery;
|
import org.hibernate.query.criteria.JpaCriteriaQuery;
|
||||||
import org.hibernate.query.criteria.JpaEntityJoin;
|
import org.hibernate.query.criteria.JpaEntityJoin;
|
||||||
|
import org.hibernate.query.criteria.JpaJoin;
|
||||||
import org.hibernate.query.criteria.JpaRoot;
|
import org.hibernate.query.criteria.JpaRoot;
|
||||||
import org.hibernate.query.criteria.JpaSubQuery;
|
import org.hibernate.query.criteria.JpaSubQuery;
|
||||||
|
|
||||||
|
@ -63,13 +64,13 @@ public class SubqueryCorrelatedEntityJoinTest {
|
||||||
final HibernateCriteriaBuilder cb = em.unwrap( Session.class ).getCriteriaBuilder();
|
final HibernateCriteriaBuilder cb = em.unwrap( Session.class ).getCriteriaBuilder();
|
||||||
final JpaCriteriaQuery<Tuple> query = cb.createTupleQuery();
|
final JpaCriteriaQuery<Tuple> query = cb.createTupleQuery();
|
||||||
final JpaRoot<Primary> primary = query.from( Primary.class );
|
final JpaRoot<Primary> primary = query.from( Primary.class );
|
||||||
final JpaEntityJoin<Secondary> secondaryJoin = primary.join( Secondary.class );
|
final JpaEntityJoin<Primary,Secondary> secondaryJoin = primary.join( Secondary.class );
|
||||||
secondaryJoin.on(
|
secondaryJoin.on(
|
||||||
cb.equal( primary.get( "secondaryFk" ), secondaryJoin.get( "id" ) )
|
cb.equal( primary.get( "secondaryFk" ), secondaryJoin.get( "id" ) )
|
||||||
);
|
);
|
||||||
final JpaSubQuery<String> subquery = query.subquery( String.class );
|
final JpaSubQuery<String> subquery = query.subquery( String.class );
|
||||||
final JpaRoot<Tertiary> tertiary = subquery.from( Tertiary.class );
|
final JpaRoot<Tertiary> tertiary = subquery.from( Tertiary.class );
|
||||||
final JpaEntityJoin<Secondary> correlatedSecondaryJoin = subquery.correlate( secondaryJoin );
|
final JpaJoin<Primary,Secondary> correlatedSecondaryJoin = subquery.correlate( secondaryJoin );
|
||||||
subquery.select( tertiary.get( "name" ) ).where( cb.equal(
|
subquery.select( tertiary.get( "name" ) ).where( cb.equal(
|
||||||
tertiary.get( "secondaryFk" ),
|
tertiary.get( "secondaryFk" ),
|
||||||
correlatedSecondaryJoin.get( "id" )
|
correlatedSecondaryJoin.get( "id" )
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class DeleteJoinTests {
|
||||||
final HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
|
final HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
|
||||||
final JpaCriteriaDelete<BasicEntity> criteriaDelete = cb.createCriteriaDelete( BasicEntity.class );
|
final JpaCriteriaDelete<BasicEntity> criteriaDelete = cb.createCriteriaDelete( BasicEntity.class );
|
||||||
final JpaRoot<BasicEntity> b = criteriaDelete.from( BasicEntity.class );
|
final JpaRoot<BasicEntity> b = criteriaDelete.from( BasicEntity.class );
|
||||||
final JpaEntityJoin<Contact> c = b.join( Contact.class, SqmJoinType.LEFT );
|
final JpaEntityJoin<BasicEntity, Contact> c = b.join( Contact.class, SqmJoinType.LEFT );
|
||||||
c.on( b.get( "id" ).equalTo( c.get( "id" ) ) );
|
c.on( b.get( "id" ).equalTo( c.get( "id" ) ) );
|
||||||
criteriaDelete.where( c.get( "id" ).isNotNull() );
|
criteriaDelete.where( c.get( "id" ).isNotNull() );
|
||||||
int updated = session.createMutationQuery( criteriaDelete ).executeUpdate();
|
int updated = session.createMutationQuery( criteriaDelete ).executeUpdate();
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class UpdateJoinTests {
|
||||||
final HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
|
final HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
|
||||||
final JpaCriteriaUpdate<BasicEntity> criteriaUpdate = cb.createCriteriaUpdate( BasicEntity.class );
|
final JpaCriteriaUpdate<BasicEntity> criteriaUpdate = cb.createCriteriaUpdate( BasicEntity.class );
|
||||||
final JpaRoot<BasicEntity> b = criteriaUpdate.from( BasicEntity.class );
|
final JpaRoot<BasicEntity> b = criteriaUpdate.from( BasicEntity.class );
|
||||||
final JpaEntityJoin<Contact> c = b.join( Contact.class, SqmJoinType.LEFT );
|
final JpaEntityJoin<BasicEntity,Contact> c = b.join( Contact.class, SqmJoinType.LEFT );
|
||||||
c.on( b.get( "id" ).equalTo( c.get( "id" ) ) );
|
c.on( b.get( "id" ).equalTo( c.get( "id" ) ) );
|
||||||
criteriaUpdate.set( b.<String>get( "data" ), c.get( "name" ).get( "first" ) );
|
criteriaUpdate.set( b.<String>get( "data" ), c.get( "name" ).get( "first" ) );
|
||||||
criteriaUpdate.where( c.get( "id" ).isNotNull() );
|
criteriaUpdate.where( c.get( "id" ).isNotNull() );
|
||||||
|
|
|
@ -113,4 +113,11 @@ test.dependsOn quarkusHrPanacheTestTask
|
||||||
test.dependsOn quarkusOrmPanacheTestTask
|
test.dependsOn quarkusOrmPanacheTestTask
|
||||||
|
|
||||||
tasks.sourcesJar.dependsOn ':hibernate-core:generateHqlParser'
|
tasks.sourcesJar.dependsOn ':hibernate-core:generateHqlParser'
|
||||||
tasks.sourcesJar.dependsOn ':hibernate-core:generateSqlScriptParser'
|
tasks.sourcesJar.dependsOn ':hibernate-core:generateSqlScriptParser'
|
||||||
|
|
||||||
|
compileTestJava {
|
||||||
|
options.compilerArgs += [
|
||||||
|
"-proc:none",
|
||||||
|
"-AsuppressJakartaDataMetamodel=true"
|
||||||
|
]
|
||||||
|
}
|
|
@ -27,10 +27,7 @@ import javax.lang.model.util.Elements;
|
||||||
import javax.lang.model.util.Types;
|
import javax.lang.model.util.Types;
|
||||||
import javax.tools.Diagnostic;
|
import javax.tools.Diagnostic;
|
||||||
|
|
||||||
import org.hibernate.jpamodelgen.model.Metamodel;
|
|
||||||
import org.hibernate.jpamodelgen.util.AccessTypeInformation;
|
|
||||||
import org.hibernate.processor.model.Metamodel;
|
import org.hibernate.processor.model.Metamodel;
|
||||||
import org.hibernate.processor.util.AccessType;
|
|
||||||
import org.hibernate.processor.util.AccessTypeInformation;
|
import org.hibernate.processor.util.AccessTypeInformation;
|
||||||
|
|
||||||
import jakarta.persistence.AccessType;
|
import jakarta.persistence.AccessType;
|
||||||
|
|
|
@ -204,7 +204,7 @@ public class HibernateProcessor extends AbstractProcessor {
|
||||||
|
|
||||||
final boolean fullyAnnotationConfigured = handleSettings( processingEnvironment );
|
final boolean fullyAnnotationConfigured = handleSettings( processingEnvironment );
|
||||||
if ( !fullyAnnotationConfigured ) {
|
if ( !fullyAnnotationConfigured ) {
|
||||||
new JpaDescriptorParser( context ).parseXml();
|
new JpaDescriptorParser( context ).parseMappingXml();
|
||||||
if ( context.isFullyXmlConfigured() ) {
|
if ( context.isFullyXmlConfigured() ) {
|
||||||
createMetaModelClasses();
|
createMetaModelClasses();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.hibernate.processor.ProcessLaterException;
|
||||||
import org.hibernate.processor.model.ImportContext;
|
import org.hibernate.processor.model.ImportContext;
|
||||||
import org.hibernate.processor.model.MetaAttribute;
|
import org.hibernate.processor.model.MetaAttribute;
|
||||||
import org.hibernate.processor.model.Metamodel;
|
import org.hibernate.processor.model.Metamodel;
|
||||||
import org.hibernate.processor.util.AccessType;
|
|
||||||
import org.hibernate.processor.util.AccessTypeInformation;
|
import org.hibernate.processor.util.AccessTypeInformation;
|
||||||
import org.hibernate.processor.util.Constants;
|
import org.hibernate.processor.util.Constants;
|
||||||
import org.hibernate.processor.validation.ProcessorSessionFactory;
|
import org.hibernate.processor.validation.ProcessorSessionFactory;
|
||||||
|
@ -55,25 +54,6 @@ import javax.lang.model.util.Elements;
|
||||||
import javax.lang.model.util.Types;
|
import javax.lang.model.util.Types;
|
||||||
import javax.tools.Diagnostic;
|
import javax.tools.Diagnostic;
|
||||||
|
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
|
||||||
import org.hibernate.jpamodelgen.Context;
|
|
||||||
import org.hibernate.jpamodelgen.ImportContextImpl;
|
|
||||||
import org.hibernate.jpamodelgen.ProcessLaterException;
|
|
||||||
import org.hibernate.jpamodelgen.model.ImportContext;
|
|
||||||
import org.hibernate.jpamodelgen.model.MetaAttribute;
|
|
||||||
import org.hibernate.jpamodelgen.model.Metamodel;
|
|
||||||
import org.hibernate.jpamodelgen.util.AccessTypeInformation;
|
|
||||||
import org.hibernate.jpamodelgen.util.Constants;
|
|
||||||
import org.hibernate.jpamodelgen.validation.ProcessorSessionFactory;
|
|
||||||
import org.hibernate.jpamodelgen.validation.Validation;
|
|
||||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
|
||||||
import org.hibernate.query.criteria.JpaEntityJoin;
|
|
||||||
import org.hibernate.query.criteria.JpaRoot;
|
|
||||||
import org.hibernate.query.criteria.JpaSelection;
|
|
||||||
import org.hibernate.query.sqm.SqmExpressible;
|
|
||||||
import org.hibernate.query.sqm.tree.SqmStatement;
|
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
|
||||||
import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.processor.annotation;
|
package org.hibernate.processor.annotation;
|
||||||
|
|
||||||
|
import jakarta.persistence.AccessType;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.hibernate.processor.Context;
|
import org.hibernate.processor.Context;
|
||||||
import org.hibernate.processor.util.AccessType;
|
|
||||||
import org.hibernate.processor.util.AccessTypeInformation;
|
import org.hibernate.processor.util.AccessTypeInformation;
|
||||||
import org.hibernate.processor.util.Constants;
|
import org.hibernate.processor.util.Constants;
|
||||||
import org.hibernate.processor.util.NullnessUtil;
|
import org.hibernate.processor.util.NullnessUtil;
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
/*
|
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
|
||||||
*
|
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
|
||||||
*/
|
|
||||||
package org.hibernate.processor.util;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Hardy Ferentschik
|
|
||||||
*/
|
|
||||||
public enum AccessType {
|
|
||||||
PROPERTY( jakarta.persistence.AccessType.PROPERTY ),
|
|
||||||
FIELD( jakarta.persistence.AccessType.FIELD );
|
|
||||||
|
|
||||||
private final jakarta.persistence.AccessType jpaAccessType;
|
|
||||||
|
|
||||||
AccessType(jakarta.persistence.AccessType jpaAccessType) {
|
|
||||||
this.jpaAccessType = jpaAccessType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public jakarta.persistence.AccessType getJpaAccessType() {
|
|
||||||
return jpaAccessType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AccessType fromJpaAccessType(jakarta.persistence.AccessType jpaAccessType) {
|
|
||||||
if ( jpaAccessType == jakarta.persistence.AccessType.FIELD ) {
|
|
||||||
return FIELD;
|
|
||||||
}
|
|
||||||
if ( jpaAccessType == jakarta.persistence.AccessType.PROPERTY ) {
|
|
||||||
return PROPERTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new IllegalArgumentException( "Unknown JPA AccessType - " + jpaAccessType.name() );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -33,8 +33,6 @@ import javax.lang.model.util.SimpleTypeVisitor8;
|
||||||
import javax.tools.Diagnostic;
|
import javax.tools.Diagnostic;
|
||||||
|
|
||||||
import jakarta.persistence.AccessType;
|
import jakarta.persistence.AccessType;
|
||||||
import org.hibernate.jpamodelgen.Context;
|
|
||||||
import org.hibernate.jpamodelgen.MetaModelGenerationException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -25,11 +25,8 @@ import javax.xml.validation.SchemaFactory;
|
||||||
|
|
||||||
import org.hibernate.boot.jaxb.cfg.spi.ObjectFactory;
|
import org.hibernate.boot.jaxb.cfg.spi.ObjectFactory;
|
||||||
|
|
||||||
import org.hibernate.jpamodelgen.Context;
|
|
||||||
import org.hibernate.jpamodelgen.util.NullnessUtil;
|
|
||||||
import org.hibernate.processor.Context;
|
import org.hibernate.processor.Context;
|
||||||
import org.hibernate.processor.util.NullnessUtil;
|
import org.hibernate.processor.util.NullnessUtil;
|
||||||
import org.hibernate.processor.xml.jaxb.ObjectFactory;
|
|
||||||
|
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
|
@ -38,25 +38,12 @@ import org.hibernate.boot.jaxb.mapping.spi.JaxbPersistenceUnitDefaultsImpl;
|
||||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbPersistenceUnitMetadataImpl;
|
import org.hibernate.boot.jaxb.mapping.spi.JaxbPersistenceUnitMetadataImpl;
|
||||||
import org.hibernate.boot.jaxb.spi.Binding;
|
import org.hibernate.boot.jaxb.spi.Binding;
|
||||||
import org.hibernate.boot.jaxb.spi.JaxbBindableMappingDescriptor;
|
import org.hibernate.boot.jaxb.spi.JaxbBindableMappingDescriptor;
|
||||||
import org.hibernate.jpamodelgen.Context;
|
|
||||||
import org.hibernate.jpamodelgen.util.AccessTypeInformation;
|
|
||||||
import org.hibernate.jpamodelgen.util.FileTimeStampChecker;
|
|
||||||
import org.hibernate.jpamodelgen.util.StringUtil;
|
|
||||||
import org.hibernate.jpamodelgen.util.TypeUtils;
|
|
||||||
import org.hibernate.jpamodelgen.util.xml.XmlParserHelper;
|
|
||||||
import org.hibernate.processor.Context;
|
import org.hibernate.processor.Context;
|
||||||
import org.hibernate.processor.util.AccessType;
|
|
||||||
import org.hibernate.processor.util.AccessTypeInformation;
|
import org.hibernate.processor.util.AccessTypeInformation;
|
||||||
import org.hibernate.processor.util.FileTimeStampChecker;
|
import org.hibernate.processor.util.FileTimeStampChecker;
|
||||||
import org.hibernate.processor.util.StringUtil;
|
import org.hibernate.processor.util.StringUtil;
|
||||||
import org.hibernate.processor.util.TypeUtils;
|
import org.hibernate.processor.util.TypeUtils;
|
||||||
import org.hibernate.processor.util.xml.XmlParserHelper;
|
import org.hibernate.processor.util.xml.XmlParserHelper;
|
||||||
import org.hibernate.processor.util.xml.XmlParsingException;
|
|
||||||
import org.hibernate.processor.xml.jaxb.Entity;
|
|
||||||
import org.hibernate.processor.xml.jaxb.EntityMappings;
|
|
||||||
import org.hibernate.processor.xml.jaxb.Persistence;
|
|
||||||
import org.hibernate.processor.xml.jaxb.PersistenceUnitDefaults;
|
|
||||||
import org.hibernate.processor.xml.jaxb.PersistenceUnitMetadata;
|
|
||||||
|
|
||||||
import jakarta.persistence.AccessType;
|
import jakarta.persistence.AccessType;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
|
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
|
||||||
|
*/
|
||||||
|
package org.hibernate.processor.xml;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import javax.tools.FileObject;
|
||||||
|
import javax.tools.StandardLocation;
|
||||||
|
|
||||||
|
import org.hibernate.boot.ResourceStreamLocator;
|
||||||
|
import org.hibernate.processor.Context;
|
||||||
|
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
public class ResourceStreamLocatorImpl implements ResourceStreamLocator {
|
||||||
|
/**
|
||||||
|
* Path separator used for resource loading
|
||||||
|
*/
|
||||||
|
private static final String RESOURCE_PATH_SEPARATOR = "/";
|
||||||
|
|
||||||
|
private final Context context;
|
||||||
|
|
||||||
|
public ResourceStreamLocatorImpl(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable InputStream locateResourceStream(String resourceName) {
|
||||||
|
// METAGEN-75
|
||||||
|
if ( !resourceName.startsWith( RESOURCE_PATH_SEPARATOR ) ) {
|
||||||
|
resourceName = RESOURCE_PATH_SEPARATOR + resourceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
String pkg = getPackage( resourceName );
|
||||||
|
String name = getRelativeName( resourceName );
|
||||||
|
InputStream ormStream;
|
||||||
|
try {
|
||||||
|
FileObject fileObject = context.getProcessingEnvironment()
|
||||||
|
.getFiler()
|
||||||
|
.getResource( StandardLocation.CLASS_OUTPUT, pkg, name );
|
||||||
|
ormStream = fileObject.openInputStream();
|
||||||
|
}
|
||||||
|
catch ( IOException e1 ) {
|
||||||
|
// TODO - METAGEN-12
|
||||||
|
// unfortunately, the Filer.getResource API seems not to be able to load from /META-INF. One gets a
|
||||||
|
// FilerException with the message with "Illegal name /META-INF". This means that we have to revert to
|
||||||
|
// using the classpath. This might mean that we find a persistence.xml which is 'part of another jar.
|
||||||
|
// Not sure what else we can do here
|
||||||
|
ormStream = this.getClass().getResourceAsStream( resourceName );
|
||||||
|
}
|
||||||
|
return ormStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getPackage(String resourceName) {
|
||||||
|
if ( !resourceName.contains("/") ) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return resourceName.substring( 0, resourceName.lastIndexOf("/") );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getRelativeName(String resourceName) {
|
||||||
|
if ( !resourceName.contains("/") ) {
|
||||||
|
return resourceName;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return resourceName.substring( resourceName.lastIndexOf("/") + 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,17 +33,6 @@ import org.hibernate.boot.jaxb.mapping.spi.JaxbMapKeyClassImpl;
|
||||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbMappedSuperclassImpl;
|
import org.hibernate.boot.jaxb.mapping.spi.JaxbMappedSuperclassImpl;
|
||||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbOneToManyImpl;
|
import org.hibernate.boot.jaxb.mapping.spi.JaxbOneToManyImpl;
|
||||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbOneToOneImpl;
|
import org.hibernate.boot.jaxb.mapping.spi.JaxbOneToOneImpl;
|
||||||
import org.hibernate.jpamodelgen.Context;
|
|
||||||
import org.hibernate.jpamodelgen.ImportContextImpl;
|
|
||||||
import org.hibernate.jpamodelgen.MetaModelGenerationException;
|
|
||||||
import org.hibernate.jpamodelgen.model.ImportContext;
|
|
||||||
import org.hibernate.jpamodelgen.model.MetaAttribute;
|
|
||||||
import org.hibernate.jpamodelgen.model.Metamodel;
|
|
||||||
import org.hibernate.jpamodelgen.util.AccessTypeInformation;
|
|
||||||
import org.hibernate.jpamodelgen.util.Constants;
|
|
||||||
import org.hibernate.jpamodelgen.util.NullnessUtil;
|
|
||||||
import org.hibernate.jpamodelgen.util.StringUtil;
|
|
||||||
import org.hibernate.jpamodelgen.util.TypeUtils;
|
|
||||||
import org.hibernate.processor.Context;
|
import org.hibernate.processor.Context;
|
||||||
import org.hibernate.processor.ImportContextImpl;
|
import org.hibernate.processor.ImportContextImpl;
|
||||||
import org.hibernate.processor.MetaModelGenerationException;
|
import org.hibernate.processor.MetaModelGenerationException;
|
||||||
|
@ -55,21 +44,6 @@ import org.hibernate.processor.util.Constants;
|
||||||
import org.hibernate.processor.util.NullnessUtil;
|
import org.hibernate.processor.util.NullnessUtil;
|
||||||
import org.hibernate.processor.util.StringUtil;
|
import org.hibernate.processor.util.StringUtil;
|
||||||
import org.hibernate.processor.util.TypeUtils;
|
import org.hibernate.processor.util.TypeUtils;
|
||||||
import org.hibernate.processor.xml.jaxb.Attributes;
|
|
||||||
import org.hibernate.processor.xml.jaxb.Basic;
|
|
||||||
import org.hibernate.processor.xml.jaxb.ElementCollection;
|
|
||||||
import org.hibernate.processor.xml.jaxb.Embeddable;
|
|
||||||
import org.hibernate.processor.xml.jaxb.EmbeddableAttributes;
|
|
||||||
import org.hibernate.processor.xml.jaxb.Embedded;
|
|
||||||
import org.hibernate.processor.xml.jaxb.EmbeddedId;
|
|
||||||
import org.hibernate.processor.xml.jaxb.Entity;
|
|
||||||
import org.hibernate.processor.xml.jaxb.Id;
|
|
||||||
import org.hibernate.processor.xml.jaxb.ManyToMany;
|
|
||||||
import org.hibernate.processor.xml.jaxb.ManyToOne;
|
|
||||||
import org.hibernate.processor.xml.jaxb.MapKeyClass;
|
|
||||||
import org.hibernate.processor.xml.jaxb.MappedSuperclass;
|
|
||||||
import org.hibernate.processor.xml.jaxb.OneToMany;
|
|
||||||
import org.hibernate.processor.xml.jaxb.OneToOne;
|
|
||||||
|
|
||||||
import jakarta.persistence.AccessType;
|
import jakarta.persistence.AccessType;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
@ -82,7 +56,6 @@ import static org.hibernate.processor.util.StringUtil.determineFullyQualifiedCla
|
||||||
import static org.hibernate.processor.util.TypeUtils.extractClosestRealTypeAsString;
|
import static org.hibernate.processor.util.TypeUtils.extractClosestRealTypeAsString;
|
||||||
import static org.hibernate.processor.util.TypeUtils.findMappedSuperClass;
|
import static org.hibernate.processor.util.TypeUtils.findMappedSuperClass;
|
||||||
import static org.hibernate.processor.util.TypeUtils.getElementKindForAccessType;
|
import static org.hibernate.processor.util.TypeUtils.getElementKindForAccessType;
|
||||||
import static org.hibernate.processor.xml.jaxb.AccessType.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collects XML-based meta information about an annotated type (entity, embeddable or mapped superclass).
|
* Collects XML-based meta information about an annotated type (entity, embeddable or mapped superclass).
|
||||||
|
|
Loading…
Reference in New Issue