mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-07 03:38:16 +00:00
6 - SQM based on JPA type system
- Initial work on SQL AST generation based on older persister model
This commit is contained in:
parent
bb207c0926
commit
0c66f23af2
@ -5,43 +5,145 @@ The Hibernate "type system" is multi-layered....
|
||||
|
||||
== JavaTypeDescriptor
|
||||
|
||||
At the lowest level we have `JavaTypeDescriptor` which describes very rudimentary information about
|
||||
Java types (`Class`). This level makes no distinctions based about the nature of the type. E.g.
|
||||
it does not understand that `Person` is an entity.
|
||||
At the lowest level we have `JavaTypeDescriptor` which describes information about Java types
|
||||
(`Class`). This level makes no distinctions based about the nature of the type. E.g. it does
|
||||
not understand that `Person` is an entity.
|
||||
|
||||
|
||||
== JPA type system (SQM)
|
||||
== Domain type system (JPA/SQM)
|
||||
|
||||
The JPA type system is an "unmapped" model, meaning that it has no mapping information -
|
||||
no references to tables, columns, etc. The base contract for Hibernate's extension to the
|
||||
JPA model is `org.hibernate.metamodel.model.domain.DomainType`.
|
||||
|
||||
Hibernate's Semantic Query Model (SQM) is defined in terms of these JPA type extensions,
|
||||
through the `org.hibernate.query.sqm.SqmExpressable` contract allowing parts of the application's
|
||||
domain model to be used as part of an SQM tree.
|
||||
|
||||
|
||||
[plantuml,SqmTypeSystem,png]
|
||||
.SqmTypeSystem
|
||||
.Domain (JPA/SQM) type system
|
||||
....
|
||||
@startuml
|
||||
skinparam handwritten true
|
||||
|
||||
interface DomainType
|
||||
interface SimpleDomainType
|
||||
interface BasicDomainType
|
||||
interface AnyMappingDomainType
|
||||
interface ManagedDomainType
|
||||
interface EmbeddableDomainType
|
||||
interface IdentifiableDomainType
|
||||
interface EntityDomainType
|
||||
interface MappedSuperclassDomainType
|
||||
|
||||
interface SqmExpressable
|
||||
interface SqmPathSource
|
||||
interface EntityDomainType
|
||||
interface BasicDomainType
|
||||
interface PeristentAttribute
|
||||
interface SingularePersistentAttribute
|
||||
interface PersistentAttribute
|
||||
interface SingularPersistentAttribute
|
||||
interface PluralPersistentAttribute
|
||||
|
||||
DomainType <|-- SimpleDomainType
|
||||
SimpleDomainType <|-- BasicDomainType
|
||||
SimpleDomainType <|-- AnyMappingDomainType
|
||||
SimpleDomainType <|-- ManagedDomainType
|
||||
ManagedDomainType <|-- EmbeddableDomainType
|
||||
ManagedDomainType <|-- IdentifiableDomainType
|
||||
IdentifiableDomainType <|-- MappedSuperclassDomainType
|
||||
IdentifiableDomainType <|-- EntityDomainType
|
||||
|
||||
SqmExpressable <|-- DomainType
|
||||
SqmExpressable <|-- SqmPathSource
|
||||
SqmExpressable <|-- BasicDomainType
|
||||
|
||||
SqmPathSource <|-- EntityDomainType
|
||||
SqmPathSource <|-- PeristentAttribute
|
||||
SqmPathSource <|-- PersistentAttribute
|
||||
|
||||
PeristentAttribute <|-- SingularePersistentAttribute
|
||||
PeristentAttribute <|-- PluralPersistentAttribute
|
||||
PersistentAttribute <|-- SingularPersistentAttribute
|
||||
PersistentAttribute <|-- PluralPersistentAttribute
|
||||
|
||||
@enduml
|
||||
....
|
||||
|
||||
|
||||
|
||||
== Mapping model
|
||||
|
||||
- persisters, etc...
|
||||
TBC...
|
||||
|
||||
todo : document this one
|
||||
[plantuml,SqmTypeSystem,png]
|
||||
.Mapping type system
|
||||
....
|
||||
@startuml
|
||||
skinparam handwritten true
|
||||
|
||||
interface ValueMapping
|
||||
interface BasicType
|
||||
interface ModelPart
|
||||
interface ModelPartContainer
|
||||
|
||||
ValueMapping <|-- BasicType
|
||||
ValueMapping <|-- ModelPart
|
||||
ModelPartContainer <|-- EntityMapping
|
||||
ModelPartContainer <|-- EmbeddableMapping
|
||||
ModelPart <|-- EmbeddableMapping
|
||||
ModelPart <|-- AttributeMapping
|
||||
ModelPart <|-- EntityIdentifierMapping
|
||||
ModelPart <|-- EntityVersionMapping
|
||||
ModelPart <|-- EntityDiscriminatorMapping
|
||||
|
||||
|
||||
@enduml
|
||||
....
|
||||
|
||||
[source,JAVA]
|
||||
----
|
||||
interface ValueMapping {
|
||||
Type getMappingType();
|
||||
<X> X getCapability(Class<X> capabilityType);
|
||||
...
|
||||
}
|
||||
|
||||
interface ModelPart extends ValueMapping {
|
||||
<T> DomainResult<T> createDomainResult(...);
|
||||
void applySqlSelections(...);
|
||||
...
|
||||
}
|
||||
|
||||
interface ModelPartContainer extends ValueMapping {
|
||||
void visitSubMappings(Consumer<ModelPart> action);
|
||||
ModelPart findSubPart(String name);
|
||||
ModelPart resolveSubPart(String path);
|
||||
}
|
||||
|
||||
interface EntityMapping extends ModelPartContainer {
|
||||
default EntityPersister getEntityPersister() {
|
||||
return getCapability( EntityPersister.class );
|
||||
}
|
||||
|
||||
default EntityIdentifierMapping getIdentifierMapping() {
|
||||
return getCapability( EntityIdentifierMapping.class );
|
||||
}
|
||||
|
||||
default EntityVersionMapping getVersionMapping() {
|
||||
return getCapability( EntityVersionMapping.class );
|
||||
}
|
||||
|
||||
default EntityDiscriminatorMapping getDiscriminatorMapping() {
|
||||
return getCapability( EntityDiscriminatorMapping.class );
|
||||
}
|
||||
|
||||
...
|
||||
}
|
||||
|
||||
interface EmbeddableMapping extends ModelPart, ModelPartContainer {
|
||||
...
|
||||
}
|
||||
----
|
||||
|
||||
|
||||
`org.hibernate.metamodel.model.mapping` contract corollaries in `org.hibernate.persister.walking`:
|
||||
|
||||
EntityMapping::EntityDefinition
|
||||
EmbeddableMapping::CompositionDefinition
|
||||
AttributeMapping::AttributeDefinition
|
||||
EntityIdentifierMapping::EntityIdentifierDefinition
|
||||
|
@ -103,7 +103,7 @@
|
||||
import org.hibernate.mapping.SimpleValue;
|
||||
import org.hibernate.mapping.Table;
|
||||
import org.hibernate.mapping.UniqueKey;
|
||||
import org.hibernate.query.spi.NamedQueryRepository;
|
||||
import org.hibernate.query.named.NamedQueryRepository;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.TypeResolver;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
@ -48,8 +48,8 @@
|
||||
import org.hibernate.procedure.spi.NamedCallableQueryMemento;
|
||||
import org.hibernate.query.hql.spi.NamedHqlQueryMemento;
|
||||
import org.hibernate.query.internal.NamedQueryRepositoryImpl;
|
||||
import org.hibernate.query.spi.NamedQueryRepository;
|
||||
import org.hibernate.query.spi.NamedResultSetMappingMemento;
|
||||
import org.hibernate.query.named.NamedQueryRepository;
|
||||
import org.hibernate.query.named.NamedResultSetMappingMemento;
|
||||
import org.hibernate.query.sql.spi.NamedNativeQueryMemento;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.TypeResolver;
|
||||
|
@ -7,7 +7,6 @@
|
||||
package org.hibernate.boot.internal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -21,15 +20,10 @@
|
||||
import org.hibernate.boot.spi.NamedProcedureCallDefinition;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.cfg.annotations.QueryHintDefinition;
|
||||
import org.hibernate.query.spi.NamedQueryMemento;
|
||||
import org.hibernate.query.sql.spi.ResultSetMappingDescriptor;
|
||||
import org.hibernate.engine.query.spi.sql.NativeSQLQueryReturn;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.internal.SessionFactoryImpl;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.procedure.spi.NamedCallableQueryMemento;
|
||||
import org.hibernate.procedure.internal.NamedCallableQueryMementoImpl;
|
||||
import org.hibernate.procedure.internal.Util;
|
||||
import org.hibernate.procedure.spi.ParameterStrategy;
|
||||
|
||||
import static org.hibernate.procedure.spi.NamedCallableQueryMemento.ParameterMemento;
|
||||
|
@ -23,12 +23,11 @@
|
||||
import org.hibernate.engine.spi.FilterDefinition;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.id.factory.IdentifierGeneratorFactory;
|
||||
import org.hibernate.internal.SessionFactoryImpl;
|
||||
import org.hibernate.mapping.FetchProfile;
|
||||
import org.hibernate.mapping.MappedSuperclass;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Table;
|
||||
import org.hibernate.query.spi.NamedQueryRepository;
|
||||
import org.hibernate.query.named.NamedQueryRepository;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.TypeResolver;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
@ -13,7 +13,7 @@
|
||||
import org.hibernate.engine.spi.Mapping;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.mapping.MappedSuperclass;
|
||||
import org.hibernate.query.spi.NamedQueryRepository;
|
||||
import org.hibernate.query.named.NamedQueryRepository;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.TypeResolver;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
@ -7,7 +7,7 @@
|
||||
package org.hibernate.boot.spi;
|
||||
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.query.spi.NamedQueryMemento;
|
||||
import org.hibernate.query.named.NamedQueryMemento;
|
||||
|
||||
/**
|
||||
* Common attributes shared across the mapping of named HQL, native
|
||||
|
@ -7,7 +7,7 @@
|
||||
package org.hibernate.boot.spi;
|
||||
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.query.spi.NamedResultSetMappingMemento;
|
||||
import org.hibernate.query.named.NamedResultSetMappingMemento;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
@ -7,33 +7,16 @@
|
||||
package org.hibernate.cfg.annotations;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.persistence.ColumnResult;
|
||||
import javax.persistence.ConstructorResult;
|
||||
import javax.persistence.EntityResult;
|
||||
import javax.persistence.FieldResult;
|
||||
import javax.persistence.SqlResultSetMapping;
|
||||
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.NamedResultSetMappingDefinition;
|
||||
import org.hibernate.cfg.BinderHelper;
|
||||
import org.hibernate.cfg.QuerySecondPass;
|
||||
import org.hibernate.query.spi.NamedResultSetMappingMemento;
|
||||
import org.hibernate.query.sql.spi.ResultSetMappingDescriptor;
|
||||
import org.hibernate.engine.query.spi.sql.NativeSQLQueryConstructorReturn;
|
||||
import org.hibernate.engine.query.spi.sql.NativeSQLQueryRootReturn;
|
||||
import org.hibernate.engine.query.spi.sql.NativeSQLQueryScalarReturn;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.mapping.Component;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Property;
|
||||
|
@ -12,7 +12,7 @@
|
||||
import org.hibernate.boot.spi.NamedResultSetMappingDefinition;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.query.internal.NamedResultSetMappingMementoImpl;
|
||||
import org.hibernate.query.spi.NamedResultSetMappingMemento;
|
||||
import org.hibernate.query.named.NamedResultSetMappingMemento;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
@ -39,6 +39,38 @@ public static int lastIndexOfLetter(String string) {
|
||||
return string.length() - 1;
|
||||
}
|
||||
|
||||
public static String join(String seperator, String[] strings) {
|
||||
int length = strings.length;
|
||||
if ( length == 0 ) {
|
||||
return "";
|
||||
}
|
||||
// Allocate space for length * firstStringLength;
|
||||
// If strings[0] is null, then its length is defined as 4, since that's the
|
||||
// length of "null".
|
||||
final int firstStringLength = strings[0] != null ? strings[0].length() : 4;
|
||||
StringBuilder buf = new StringBuilder( length * firstStringLength )
|
||||
.append( strings[0] );
|
||||
for ( int i = 1; i < length; i++ ) {
|
||||
buf.append( seperator ).append( strings[i] );
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public static String join(String separator, Iterable objects) {
|
||||
return join( separator, objects.iterator() );
|
||||
}
|
||||
|
||||
public static String join(String seperator, Iterator<?> objects) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
if ( objects.hasNext() ) {
|
||||
buf.append( objects.next() );
|
||||
}
|
||||
while ( objects.hasNext() ) {
|
||||
buf.append( seperator ).append( objects.next() );
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public static String joinWithQualifierAndSuffix(
|
||||
String[] values,
|
||||
String qualifier,
|
||||
@ -56,17 +88,6 @@ public static String joinWithQualifierAndSuffix(
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public static String join(String separator, Iterator<?> objects) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
if ( objects.hasNext() ) {
|
||||
buf.append( objects.next() );
|
||||
}
|
||||
while ( objects.hasNext() ) {
|
||||
buf.append( separator ).append( objects.next() );
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public static String[] add(String[] x, String sep, String[] y) {
|
||||
final String[] result = new String[x.length];
|
||||
for ( int i = 0; i < x.length; i++ ) {
|
||||
|
@ -6,8 +6,16 @@
|
||||
*/
|
||||
package org.hibernate.loader.spi;
|
||||
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||
import org.hibernate.metamodel.model.mapping.spi.ModelPart;
|
||||
import org.hibernate.query.NavigablePath;
|
||||
import org.hibernate.sql.ast.JoinType;
|
||||
import org.hibernate.sql.ast.spi.SqlAliasBaseGenerator;
|
||||
import org.hibernate.sql.ast.spi.SqlAstCreationContext;
|
||||
import org.hibernate.sql.ast.tree.from.RootTableGroupProducer;
|
||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||
|
||||
/**
|
||||
* Contract for things that can be loaded by a Loader.
|
||||
@ -18,8 +26,19 @@
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface Loadable extends ModelPart {
|
||||
public interface Loadable extends ModelPart, RootTableGroupProducer {
|
||||
boolean isAffectedByEnabledFilters(LoadQueryInfluencers influencers);
|
||||
boolean isAffectedByEntityGraph(LoadQueryInfluencers influencers);
|
||||
boolean isAffectedByEnabledFetchProfiles(LoadQueryInfluencers influencers);
|
||||
|
||||
@Override
|
||||
default TableGroup createRootTableGroup(
|
||||
NavigablePath navigablePath,
|
||||
String explicitSourceAlias,
|
||||
JoinType tableReferenceJoinType,
|
||||
LockMode lockMode,
|
||||
SqlAliasBaseGenerator aliasBaseGenerator,
|
||||
SqlAstCreationContext creationContext) {
|
||||
throw new NotYetImplementedFor6Exception( getClass() );
|
||||
}
|
||||
}
|
||||
|
@ -6,14 +6,14 @@
|
||||
*/
|
||||
package org.hibernate.metamodel.model.convert.spi;
|
||||
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.metamodel.model.mapping.spi.ValueMapping;
|
||||
|
||||
/**
|
||||
* Describes a part of the domain model to which a value converter can be applied
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface ConvertibleValueMapping<O> extends SqmExpressable<O> {
|
||||
public interface ConvertibleValueMapping<O> extends ValueMapping {
|
||||
/**
|
||||
* Get the value converter associated with this value mapping. May
|
||||
* return {@code null}
|
||||
|
@ -7,11 +7,8 @@
|
||||
package org.hibernate.metamodel.model.domain;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.metamodel.model.mapping.spi.Writeable;
|
||||
import org.hibernate.query.Query;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
/**
|
||||
* Specialization of DomainType for types that can be used as {@link Query} parameter bind values.
|
||||
@ -21,8 +18,4 @@
|
||||
@Incubating
|
||||
public interface AllowableParameterType<J> extends SimpleDomainType<J> {
|
||||
JavaTypeDescriptor<J> getExpressableJavaTypeDescriptor();
|
||||
|
||||
default Writeable resolveWriteable(TypeConfiguration typeConfiguration) {
|
||||
throw new NotYetImplementedFor6Exception( getClass() );
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,6 @@
|
||||
*/
|
||||
package org.hibernate.metamodel.model.domain;
|
||||
|
||||
import org.hibernate.metamodel.model.mapping.spi.Writeable;
|
||||
|
||||
/**
|
||||
* Describes any non-collection type
|
||||
*
|
||||
|
@ -14,7 +14,7 @@
|
||||
import org.hibernate.metamodel.model.domain.SimpleDomainType;
|
||||
import org.hibernate.query.NavigablePath;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPluralValuedSimplePath;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
|
@ -9,7 +9,7 @@
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.metamodel.model.domain.AnyMappingDomainType;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
|
||||
/**
|
||||
|
@ -11,7 +11,7 @@
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.metamodel.model.domain.BagPersistentAttribute;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmBagJoin;
|
||||
import org.hibernate.query.sqm.tree.from.SqmAttributeJoin;
|
||||
|
@ -12,7 +12,7 @@
|
||||
import org.hibernate.query.NavigablePath;
|
||||
import org.hibernate.query.sqm.IllegalPathUsageException;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmBasicValuedSimplePath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.EmbeddableDomainType;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmEmbeddedValuedSimplePath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
import org.hibernate.metamodel.model.domain.SingularPersistentAttribute;
|
||||
import org.hibernate.query.SemanticException;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmEntityValuedSimplePath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
import org.hibernate.metamodel.model.domain.PersistentAttribute;
|
||||
import org.hibernate.metamodel.model.domain.SingularPersistentAttribute;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
import org.hibernate.metamodel.model.domain.ListPersistentAttribute;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmListJoin;
|
||||
import org.hibernate.query.sqm.tree.from.SqmAttributeJoin;
|
||||
|
@ -12,7 +12,7 @@
|
||||
import org.hibernate.metamodel.model.domain.MapPersistentAttribute;
|
||||
import org.hibernate.metamodel.model.domain.SimpleDomainType;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmMapJoin;
|
||||
import org.hibernate.query.sqm.tree.from.SqmAttributeJoin;
|
||||
|
@ -9,7 +9,7 @@
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.SetPersistentAttribute;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmSetJoin;
|
||||
import org.hibernate.query.sqm.tree.from.SqmAttributeJoin;
|
||||
|
@ -16,7 +16,7 @@
|
||||
import org.hibernate.metamodel.model.domain.SimpleDomainType;
|
||||
import org.hibernate.metamodel.model.domain.SingularPersistentAttribute;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmSingularJoin;
|
||||
|
@ -11,16 +11,20 @@
|
||||
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.persister.SqlExpressableType;
|
||||
import org.hibernate.sql.ast.Clause;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
/**
|
||||
* Contract for things at the domain/mapping level that can be bound into a JDBC query
|
||||
* Contract for things at the domain/mapping level that can be bound into a JDBC
|
||||
* query.
|
||||
*
|
||||
* `SqlAstExpressable`? Similar to `SqmExpressable`.
|
||||
*
|
||||
* Notice that there may be more than one JDBC parameter involved here - an embedded value, e.g.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface Writeable {
|
||||
public interface Bindable {
|
||||
default int getJdbcTypeCount(TypeConfiguration typeConfiguration) {
|
||||
final AtomicInteger value = new AtomicInteger( 0 );
|
||||
visitJdbcTypes(
|
||||
@ -74,7 +78,7 @@ default void visitJdbcTypes(
|
||||
* ````
|
||||
*
|
||||
* At the top-level, we would want to disassemble a `Person` value so we'd ask the
|
||||
* `Writeable` for the `Person` entity to disassemble. Given a Person value:
|
||||
* `Bindable` for the `Person` entity to disassemble. Given a Person value:
|
||||
*
|
||||
* ````
|
||||
* Person( id=1, name=Name( 'Steve', 'Ebersole' ), 28 )
|
||||
@ -86,10 +90,6 @@ default void visitJdbcTypes(
|
||||
* [ ["Steve", "Ebersole"], 28 ]
|
||||
* ````
|
||||
*
|
||||
* ````
|
||||
* JdbcValues( "Steve", "Ebersole", 28 )
|
||||
* ````
|
||||
*
|
||||
* Note that the identifier is not part of this disassembled state. Note also
|
||||
* how the embedded value results in a sub-array.
|
||||
*/
|
@ -21,14 +21,13 @@
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface ModelPart {
|
||||
public interface ModelPart extends ValueMapping {
|
||||
|
||||
/**
|
||||
* Create a DomainResult for a specific reference to this ModelPart.
|
||||
*/
|
||||
default <T> DomainResult<T> createDomainResult(
|
||||
NavigablePath navigablePath,
|
||||
int valuesArrayPosition,
|
||||
String resultVariable,
|
||||
DomainResultCreationState creationState) {
|
||||
throw new NotYetImplementedFor6Exception( getClass() );
|
||||
@ -42,9 +41,4 @@ default void applySqlSelections(
|
||||
DomainResultCreationState creationState) {
|
||||
throw new NotYetImplementedFor6Exception( getClass() );
|
||||
}
|
||||
|
||||
default Writeable getWriteable() {
|
||||
// todo (6.0) : or in-line
|
||||
throw new NotYetImplementedFor6Exception( getClass() );
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,7 @@
|
||||
* 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.sql.ast.tree.expression;
|
||||
|
||||
import org.hibernate.persister.SqlExpressableType;
|
||||
package org.hibernate.metamodel.model.mapping.spi;
|
||||
|
||||
/**
|
||||
* Unifying contract for things that are capable of being an expression in
|
@ -4,7 +4,7 @@
|
||||
* 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.persister;
|
||||
package org.hibernate.metamodel.model.mapping.spi;
|
||||
|
||||
import org.hibernate.type.descriptor.ValueBinder;
|
||||
import org.hibernate.type.descriptor.ValueExtractor;
|
@ -9,6 +9,7 @@
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.sql.ast.ValueMappingExpressable;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
@ -21,7 +22,7 @@
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface ValueMapping extends ModelPart {
|
||||
public interface ValueMapping extends ValueMappingExpressable {
|
||||
|
||||
/**
|
||||
* Get the Type associated with this mapping
|
||||
@ -30,14 +31,27 @@ default Type getValueType() {
|
||||
throw new NotYetImplementedFor6Exception( getClass() );
|
||||
}
|
||||
|
||||
default Bindable getBindable() {
|
||||
throw new NotYetImplementedFor6Exception( getClass() );
|
||||
}
|
||||
|
||||
@Override
|
||||
default ValueMapping getExpressableValueMapping() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Treat operation. Asks the ValueMapping to treat itself as the
|
||||
* given `targetType`, if it can.
|
||||
*
|
||||
* @apiNote This is not necessarily limited to things the ValueMapping
|
||||
* itself implements.
|
||||
*
|
||||
* @implNote This default implementation is however limited to just
|
||||
* things the ValueMapping itself implements.
|
||||
*
|
||||
*/
|
||||
default <X> X as(Class<X> targetType) {
|
||||
default <X> X treatAs(Class<X> targetType) {
|
||||
if ( targetType.isInstance( this ) ) {
|
||||
//noinspection unchecked
|
||||
return (X) this;
|
||||
|
@ -10,14 +10,17 @@
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.graph.RootGraph;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.metamodel.model.domain.JpaMetamodel;
|
||||
import org.hibernate.metamodel.model.domain.ManagedDomainType;
|
||||
import org.hibernate.metamodel.model.domain.NavigableRole;
|
||||
import org.hibernate.metamodel.model.mapping.spi.ValueMapping;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
@ -43,6 +46,16 @@ default TypeConfiguration getTypeConfiguration() {
|
||||
return getJpaMetamodel().getTypeConfiguration();
|
||||
}
|
||||
|
||||
/**
|
||||
* todo (6.0) : POC!!! Intended for use in SQM -> SQL translation
|
||||
*
|
||||
* @param sqmExpressable
|
||||
* @return
|
||||
*/
|
||||
default ValueMapping resolveValueMapping(SqmExpressable<?> sqmExpressable) {
|
||||
throw new NotYetImplementedFor6Exception( getClass() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a Java type, determine the corresponding AllowableParameterType to
|
||||
* use implicitly
|
||||
|
@ -34,10 +34,12 @@
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.StaleObjectStateException;
|
||||
import org.hibernate.StaleStateException;
|
||||
import org.hibernate.boot.model.naming.Identifier;
|
||||
import org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer;
|
||||
import org.hibernate.bytecode.enhance.spi.interceptor.BytecodeLazyAttributeInterceptor;
|
||||
import org.hibernate.bytecode.enhance.spi.interceptor.EnhancementAsProxyLazinessInterceptor;
|
||||
@ -129,6 +131,8 @@
|
||||
import org.hibernate.persister.walking.spi.EntityIdentifierDefinition;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.property.access.internal.PropertyAccessStrategyBackRefImpl;
|
||||
import org.hibernate.query.ComparisonOperator;
|
||||
import org.hibernate.query.NavigablePath;
|
||||
import org.hibernate.sql.Alias;
|
||||
import org.hibernate.sql.Delete;
|
||||
import org.hibernate.sql.Insert;
|
||||
@ -139,6 +143,21 @@
|
||||
import org.hibernate.sql.SimpleSelect;
|
||||
import org.hibernate.sql.Template;
|
||||
import org.hibernate.sql.Update;
|
||||
import org.hibernate.sql.ast.ValueMappingExpressable;
|
||||
import org.hibernate.sql.ast.spi.SqlAliasBase;
|
||||
import org.hibernate.sql.ast.spi.SqlAliasBaseGenerator;
|
||||
import org.hibernate.sql.ast.spi.SqlAliasStemHelper;
|
||||
import org.hibernate.sql.ast.spi.SqlAstCreationContext;
|
||||
import org.hibernate.sql.ast.spi.SqlAstWalker;
|
||||
import org.hibernate.sql.ast.tree.expression.ColumnReference;
|
||||
import org.hibernate.sql.ast.tree.expression.Expression;
|
||||
import org.hibernate.sql.ast.tree.from.StandardTableGroup;
|
||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||
import org.hibernate.sql.ast.tree.from.TableReference;
|
||||
import org.hibernate.sql.ast.tree.from.TableReferenceJoin;
|
||||
import org.hibernate.sql.ast.tree.predicate.ComparisonPredicate;
|
||||
import org.hibernate.sql.ast.tree.predicate.Junction;
|
||||
import org.hibernate.sql.ast.tree.predicate.Predicate;
|
||||
import org.hibernate.stat.spi.StatisticsImplementor;
|
||||
import org.hibernate.tuple.GenerationTiming;
|
||||
import org.hibernate.tuple.InDatabaseValueGenerationStrategy;
|
||||
@ -170,6 +189,16 @@ public abstract class AbstractEntityPersister
|
||||
|
||||
public static final String ENTITY_CLASS = "class";
|
||||
|
||||
|
||||
|
||||
private final String sqlAliasStem;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private final NavigableRole navigableRole;
|
||||
|
||||
// moved up from AbstractEntityPersister ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -558,8 +587,8 @@ public AbstractEntityPersister(
|
||||
final NaturalIdDataAccess naturalIdRegionAccessStrategy,
|
||||
final PersisterCreationContext creationContext) throws HibernateException {
|
||||
|
||||
// moved up from AbstractEntityPersister ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
this.factory = creationContext.getSessionFactory();
|
||||
this.sqlAliasStem = SqlAliasStemHelper.INSTANCE.generateStemFromEntityName( persistentClass.getEntityName() );
|
||||
|
||||
this.navigableRole = new NavigableRole( persistentClass.getEntityName() );
|
||||
|
||||
@ -1072,6 +1101,99 @@ protected Map<String,String> generateLazySelectStringsByFetchGroup() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSqlAliasStem() {
|
||||
return sqlAliasStem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableGroup createRootTableGroup(
|
||||
NavigablePath navigablePath,
|
||||
String explicitSourceAlias,
|
||||
org.hibernate.sql.ast.JoinType tableReferenceJoinType,
|
||||
LockMode lockMode,
|
||||
SqlAliasBaseGenerator aliasBaseGenerator,
|
||||
SqlAstCreationContext creationContext) {
|
||||
final SqlAliasBase sqlAliasBase = aliasBaseGenerator.createSqlAliasBase( getSqlAliasStem() );
|
||||
|
||||
final TableReference primaryTableReference = resolvePrimaryTableReference( sqlAliasBase );
|
||||
|
||||
final List<TableReferenceJoin> joins = new ArrayList<>( );
|
||||
resolveTableReferenceJoins( primaryTableReference, sqlAliasBase, tableReferenceJoinType, joins::add );
|
||||
|
||||
return new StandardTableGroup(
|
||||
navigablePath,
|
||||
this,
|
||||
lockMode,
|
||||
primaryTableReference,
|
||||
joins
|
||||
);
|
||||
}
|
||||
|
||||
protected TableReference resolvePrimaryTableReference(SqlAliasBase sqlAliasBase) {
|
||||
return new TableReference( getRootTableName(), sqlAliasBase.generateNewAlias(), false );
|
||||
}
|
||||
|
||||
private void resolveTableReferenceJoins(
|
||||
TableReference rootTableReference,
|
||||
SqlAliasBase sqlAliasBase,
|
||||
org.hibernate.sql.ast.JoinType joinType,
|
||||
Consumer<TableReferenceJoin> collector) {
|
||||
|
||||
for ( int i = 0; i < getSubclassTableSpan(); i++ ) {
|
||||
collector.accept(
|
||||
createTableReferenceJoin( i, rootTableReference, joinType, sqlAliasBase )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
protected TableReferenceJoin createTableReferenceJoin(
|
||||
int subClassTablePosition,
|
||||
TableReference rootTableReference,
|
||||
org.hibernate.sql.ast.JoinType joinType,
|
||||
SqlAliasBase sqlAliasBase) {
|
||||
final boolean nullable = isNullableSubclassTable( subClassTablePosition );
|
||||
|
||||
final TableReference joinedTableReference = new TableReference(
|
||||
getSubclassTableName( subClassTablePosition ),
|
||||
sqlAliasBase.generateNewAlias(),
|
||||
nullable
|
||||
);
|
||||
|
||||
return new TableReferenceJoin(
|
||||
nullable ? org.hibernate.sql.ast.JoinType.LEFT : joinType,
|
||||
joinedTableReference,
|
||||
generateJoinPredicate( rootTableReference, joinedTableReference, subClassTablePosition )
|
||||
);
|
||||
}
|
||||
|
||||
private Predicate generateJoinPredicate(
|
||||
TableReference rootTableReference,
|
||||
TableReference joinedTableReference,
|
||||
int subClassTablePosition) {
|
||||
final Junction conjunction = new Junction( Junction.Nature.CONJUNCTION );
|
||||
|
||||
final String[] rootPkColumnNames = getKeyColumnNames();
|
||||
final String[] fkColumnNames = getSubclassTableKeyColumns( subClassTablePosition );
|
||||
|
||||
assert rootPkColumnNames.length == fkColumnNames.length;
|
||||
|
||||
for ( int i = 0; i < rootPkColumnNames.length; i++ ) {
|
||||
final String rootPkColumnName = rootPkColumnNames[i];
|
||||
final String fkColumnName = fkColumnNames[i];
|
||||
|
||||
conjunction.add(
|
||||
new ComparisonPredicate(
|
||||
new ColumnReference( Identifier.toIdentifier( rootPkColumnName ), rootTableReference, null, getFactory() ),
|
||||
ComparisonOperator.EQUAL,
|
||||
new ColumnReference( Identifier.toIdentifier( fkColumnName ), joinedTableReference, null, getFactory() )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return conjunction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueMapping findValueMapping(String name) {
|
||||
for ( AttributeDefinition attributeDefinition : attributeDefinitions ) {
|
||||
@ -1084,7 +1206,12 @@ public ValueMapping findValueMapping(String name) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitValueMappings(Consumer consumer) {
|
||||
public void visitValueMappings(Consumer<ValueMapping> consumer) {
|
||||
consumer.accept( entityIdentifierDefinition );
|
||||
|
||||
for ( AttributeDefinition attributeDefinition : attributeDefinitions ) {
|
||||
consumer.accept( attributeDefinition );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,8 @@
|
||||
import org.hibernate.metamodel.model.domain.NavigableRole;
|
||||
import org.hibernate.persister.walking.spi.EntityDefinition;
|
||||
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
|
||||
import org.hibernate.sql.ast.spi.SqlAliasStemHelper;
|
||||
import org.hibernate.sql.ast.tree.from.RootTableGroupProducer;
|
||||
import org.hibernate.tuple.entity.EntityMetamodel;
|
||||
import org.hibernate.tuple.entity.EntityTuplizer;
|
||||
import org.hibernate.type.Type;
|
||||
@ -70,7 +72,7 @@
|
||||
* @see org.hibernate.persister.spi.PersisterFactory
|
||||
* @see org.hibernate.persister.spi.PersisterClassResolver
|
||||
*/
|
||||
public interface EntityPersister extends EntityDefinition, Loadable {
|
||||
public interface EntityPersister extends EntityDefinition, Loadable, RootTableGroupProducer {
|
||||
|
||||
/**
|
||||
* The property name of the "special" identifier property in HQL
|
||||
@ -103,6 +105,11 @@ public interface EntityPersister extends EntityDefinition, Loadable {
|
||||
|
||||
NavigableRole getNavigableRole();
|
||||
|
||||
@Override
|
||||
default String getSqlAliasStem() {
|
||||
return SqlAliasStemHelper.INSTANCE.generateStemFromEntityName( getEntityName() );
|
||||
}
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// stuff that is persister-centric and/or EntityInfo-centric ~~~~~~~~~~~~~~
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -8,9 +8,6 @@
|
||||
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.annotations.Remove;
|
||||
import org.hibernate.metamodel.model.domain.DomainType;
|
||||
import org.hibernate.persister.SqlExpressableType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
|
@ -15,7 +15,7 @@
|
||||
import org.hibernate.procedure.spi.NamedCallableQueryMemento;
|
||||
import org.hibernate.query.CommonQueryContract;
|
||||
import org.hibernate.query.procedure.ProcedureParameter;
|
||||
import org.hibernate.query.spi.NameableQuery;
|
||||
import org.hibernate.query.named.NameableQuery;
|
||||
|
||||
/**
|
||||
* Defines support for executing database stored procedures and functions.
|
||||
|
@ -20,8 +20,8 @@
|
||||
import org.hibernate.procedure.spi.NamedCallableQueryMemento;
|
||||
import org.hibernate.procedure.spi.ParameterStrategy;
|
||||
import org.hibernate.procedure.spi.ProcedureParameterImplementor;
|
||||
import org.hibernate.query.spi.AbstractNamedQueryMemento;
|
||||
import org.hibernate.query.spi.NamedQueryMemento;
|
||||
import org.hibernate.query.named.AbstractNamedQueryMemento;
|
||||
import org.hibernate.query.named.NamedQueryMemento;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
|
||||
/**
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
package org.hibernate.procedure.internal;
|
||||
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.sql.results.internal.ScalarDomainResultImpl;
|
||||
import org.hibernate.sql.results.spi.DomainResult;
|
||||
@ -18,17 +19,16 @@
|
||||
public class ScalarDomainResultProducer<T> implements DomainResultProducer<T> {
|
||||
private final SqmExpressable<T> expressableType;
|
||||
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
public ScalarDomainResultProducer(SqmExpressable<T> expressableType) {
|
||||
this.expressableType = expressableType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DomainResult<T> createDomainResult(
|
||||
int valuesArrayPosition,
|
||||
String resultVariable,
|
||||
DomainResultCreationState creationState) {
|
||||
//noinspection unchecked
|
||||
return new ScalarDomainResultImpl( valuesArrayPosition, resultVariable, expressableType.getExpressableJavaTypeDescriptor() );
|
||||
throw new NotYetImplementedFor6Exception( getClass() );
|
||||
// //noinspection unchecked
|
||||
// return new ScalarDomainResultImpl( resultVariable, expressableType.getExpressableJavaTypeDescriptor() );
|
||||
}
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.metamodel.spi.DomainMetamodel;
|
||||
import org.hibernate.query.spi.NamedQueryRepository;
|
||||
import org.hibernate.query.spi.NamedResultSetMappingMemento;
|
||||
import org.hibernate.query.named.NamedQueryRepository;
|
||||
import org.hibernate.query.named.NamedResultSetMappingMemento;
|
||||
import org.hibernate.query.spi.ResultSetMapping;
|
||||
import org.hibernate.sql.results.spi.DomainResultProducer;
|
||||
import org.hibernate.type.BasicType;
|
||||
@ -72,19 +72,19 @@ public static void resolveResultSetMappingClasses(
|
||||
Consumer<DomainResultProducer> resultProducerConsumer,
|
||||
Consumer<String> querySpaceConsumer,
|
||||
SessionFactoryImplementor sessionFactory) {
|
||||
throw new NotYetImplementedFor6Exception( Util.class );
|
||||
|
||||
final DomainMetamodel domainModel = sessionFactory.getDomainModel();
|
||||
final TypeConfiguration typeConfiguration = domainModel.getTypeConfiguration();
|
||||
|
||||
for ( Class resultSetMappingClass : resultSetMappingClasses ) {
|
||||
final BasicType basicType = typeConfiguration.getBasicTypeForJavaType( resultSetMappingClass );
|
||||
if ( basicType != null ) {
|
||||
//noinspection unchecked
|
||||
resultProducerConsumer.accept( new ScalarDomainResultProducer<>( basicType ) );
|
||||
continue;
|
||||
}
|
||||
|
||||
throw new NotYetImplementedFor6Exception();
|
||||
// final DomainMetamodel domainModel = sessionFactory.getDomainModel();
|
||||
// final TypeConfiguration typeConfiguration = domainModel.getTypeConfiguration();
|
||||
//
|
||||
// for ( Class resultSetMappingClass : resultSetMappingClasses ) {
|
||||
// final BasicType basicType = typeConfiguration.getBasicTypeForJavaType( resultSetMappingClass );
|
||||
// if ( basicType != null ) {
|
||||
// //noinspection unchecked
|
||||
// resultProducerConsumer.accept( new ScalarDomainResultProducer<>( basicType ) );
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// final EntityPersister entityDescriptor = domainModel.findEntityDescriptor( resultSetMappingClass );
|
||||
// if ( entityDescriptor != null ) {
|
||||
// resultProducerConsumer.accept( new Entity );
|
||||
@ -92,6 +92,6 @@ public static void resolveResultSetMappingClasses(
|
||||
// querySpaceConsumer.accept( querySpace );
|
||||
// }
|
||||
// }
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.procedure.ProcedureCall;
|
||||
import org.hibernate.query.spi.NamedQueryMemento;
|
||||
import org.hibernate.query.named.NamedQueryMemento;
|
||||
|
||||
/**
|
||||
* Represents a "memento" (disconnected, externalizable form) of a ProcedureCall
|
||||
|
@ -15,7 +15,7 @@
|
||||
import org.hibernate.query.sqm.ParsingException;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationContext;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmEnumLiteral;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||
|
@ -10,7 +10,7 @@
|
||||
import org.hibernate.query.SemanticException;
|
||||
import org.hibernate.query.hql.spi.SemanticPathPart;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
package org.hibernate.query.hql.internal;
|
||||
|
||||
import org.hibernate.query.hql.spi.SemanticPathPart;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
import org.hibernate.query.hql.HqlInterpretationException;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.query.sqm.spi.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmEnumLiteral;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmFieldLiteral;
|
||||
|
@ -11,17 +11,13 @@
|
||||
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.query.hql.SemanticQueryProducer;
|
||||
import org.hibernate.query.hql.spi.HqlQueryImplementor;
|
||||
import org.hibernate.query.hql.spi.NamedHqlQueryMemento;
|
||||
import org.hibernate.query.spi.AbstractNamedQueryMemento;
|
||||
import org.hibernate.query.named.AbstractNamedQueryMemento;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.spi.QueryInterpretationCache;
|
||||
import org.hibernate.query.sqm.internal.QuerySqmImpl;
|
||||
import org.hibernate.query.sqm.tree.SqmStatement;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
import org.hibernate.query.hql.spi.SqmPathRegistry;
|
||||
import org.hibernate.query.sqm.SqmJoinable;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPolymorphicRootDescriptor;
|
||||
import org.hibernate.query.sqm.tree.from.SqmAttributeJoin;
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
import org.hibernate.query.SemanticException;
|
||||
import org.hibernate.query.hql.spi.SemanticPathPart;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.from.SqmFrom;
|
||||
import org.hibernate.query.sqm.tree.from.SqmQualifiedJoin;
|
||||
|
||||
|
@ -15,11 +15,11 @@
|
||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.query.NavigablePath;
|
||||
import org.hibernate.query.sqm.spi.BaseSemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmPathRegistry;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationContext;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationOptions;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationOptions;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.delete.SqmDeleteStatement;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmBasicValuedSimplePath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmEmbeddedValuedSimplePath;
|
||||
|
@ -55,16 +55,16 @@
|
||||
import org.hibernate.query.sqm.function.SqmStar;
|
||||
import org.hibernate.query.sqm.function.SqmTrimSpecification;
|
||||
import org.hibernate.query.sqm.internal.ParameterCollector;
|
||||
import org.hibernate.query.sqm.spi.SqmTreeCreationLogger;
|
||||
import org.hibernate.query.sqm.SqmTreeCreationLogger;
|
||||
import org.hibernate.query.sqm.produce.function.SqmFunctionTemplate;
|
||||
import org.hibernate.query.sqm.produce.function.spi.NamedSqmFunctionTemplate;
|
||||
import org.hibernate.query.sqm.internal.SqmDmlCreationProcessingState;
|
||||
import org.hibernate.query.sqm.internal.SqmQuerySpecCreationProcessingStateStandardImpl;
|
||||
import org.hibernate.query.sqm.spi.ParameterDeclarationContext;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationContext;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationOptions;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationOptions;
|
||||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.SqmStatement;
|
||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||
|
@ -11,7 +11,7 @@
|
||||
import org.hibernate.query.hql.SemanticQueryProducer;
|
||||
import org.hibernate.query.sqm.internal.SqmTreePrinter;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationContext;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationOptions;
|
||||
import org.hibernate.query.hql.spi.SqmCreationOptions;
|
||||
import org.hibernate.query.sqm.tree.SqmStatement;
|
||||
|
||||
/**
|
||||
|
@ -18,8 +18,8 @@
|
||||
import org.hibernate.query.sqm.AliasCollisionException;
|
||||
import org.hibernate.query.sqm.ParsingException;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.sqm.spi.SqmTreeCreationLogger;
|
||||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.sqm.SqmTreeCreationLogger;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
import org.hibernate.query.sqm.tree.from.SqmFrom;
|
||||
import org.hibernate.query.sqm.tree.select.SqmSelection;
|
||||
|
@ -6,9 +6,10 @@
|
||||
*/
|
||||
package org.hibernate.query.hql.spi;
|
||||
|
||||
import org.hibernate.query.spi.NameableQuery;
|
||||
import org.hibernate.query.named.NameableQuery;
|
||||
import org.hibernate.query.spi.ParameterMetadataImplementor;
|
||||
import org.hibernate.query.spi.QueryImplementor;
|
||||
import org.hibernate.query.sqm.tree.SqmStatement;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
@ -19,4 +20,6 @@ public interface HqlQueryImplementor<R> extends QueryImplementor<R>, NameableQue
|
||||
|
||||
@Override
|
||||
ParameterMetadataImplementor getParameterMetadata();
|
||||
|
||||
SqmStatement getSqmStatement();
|
||||
}
|
||||
|
@ -13,9 +13,9 @@
|
||||
import org.hibernate.boot.spi.NamedHqlQueryDefinition;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.query.hql.internal.NamedHqlQueryMementoImpl;
|
||||
import org.hibernate.query.spi.AbstractNamedQueryMemento;
|
||||
import org.hibernate.query.spi.NameableQuery;
|
||||
import org.hibernate.query.spi.NamedQueryMemento;
|
||||
import org.hibernate.query.named.AbstractNamedQueryMemento;
|
||||
import org.hibernate.query.named.NameableQuery;
|
||||
import org.hibernate.query.named.NamedQueryMemento;
|
||||
|
||||
/**
|
||||
* NamedQueryMemento for HQL queries
|
||||
|
@ -6,7 +6,6 @@
|
||||
*/
|
||||
package org.hibernate.query.hql.spi;
|
||||
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmSimplePath;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* 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.query.sqm.spi;
|
||||
package org.hibernate.query.hql.spi;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.query.sqm.StrictJpaComplianceViolation;
|
@ -4,10 +4,9 @@
|
||||
* 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.query.sqm.spi;
|
||||
package org.hibernate.query.hql.spi;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.query.hql.spi.SqmPathRegistry;
|
||||
import org.hibernate.query.sqm.tree.SqmQuery;
|
||||
|
||||
/**
|
@ -4,10 +4,11 @@
|
||||
* 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.query.sqm.spi;
|
||||
package org.hibernate.query.hql.spi;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.internal.util.collections.Stack;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationContext;
|
||||
|
||||
/**
|
||||
* Models the state pertaining to the creation of a single SQM.
|
@ -4,7 +4,7 @@
|
||||
* 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.query.sqm.spi;
|
||||
package org.hibernate.query.hql.spi;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.query.sqm.tree.select.SqmSelectQuery;
|
@ -11,17 +11,14 @@
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.engine.query.spi.sql.NativeSQLQuerySpecification;
|
||||
import org.hibernate.procedure.spi.NamedCallableQueryMemento;
|
||||
import org.hibernate.query.hql.SemanticQueryProducer;
|
||||
import org.hibernate.query.hql.spi.NamedHqlQueryMemento;
|
||||
import org.hibernate.query.spi.NamedQueryRepository;
|
||||
import org.hibernate.query.spi.NamedResultSetMappingMemento;
|
||||
import org.hibernate.query.named.NamedQueryRepository;
|
||||
import org.hibernate.query.named.NamedResultSetMappingMemento;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.spi.QueryInterpretationCache;
|
||||
import org.hibernate.query.sql.spi.NamedNativeQueryMemento;
|
||||
import org.hibernate.query.sqm.tree.SqmStatement;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.query.spi.NamedResultSetMappingMemento;
|
||||
import org.hibernate.query.named.NamedResultSetMappingMemento;
|
||||
import org.hibernate.query.spi.ResultSetMapping;
|
||||
|
||||
/**
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AbstractQueryParameter;
|
||||
import org.hibernate.query.spi.NamedQueryMemento;
|
||||
import org.hibernate.query.named.NamedQueryMemento;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
||||
|
||||
/**
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AbstractQueryParameter;
|
||||
import org.hibernate.query.spi.NamedQueryMemento;
|
||||
import org.hibernate.query.named.NamedQueryMemento;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
||||
|
||||
/**
|
||||
|
@ -4,7 +4,7 @@
|
||||
* 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.query.spi;
|
||||
package org.hibernate.query.named;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -13,7 +13,6 @@
|
||||
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
@ -4,13 +4,13 @@
|
||||
* 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.query.spi;
|
||||
package org.hibernate.query.named;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
|
||||
/**
|
||||
* Contract for Query impls that can be converted to a named query memento to be
|
||||
* stored in the {@link org.hibernate.query.spi.NamedQueryRepository}
|
||||
* stored in the {@link NamedQueryRepository}
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
@ -4,13 +4,15 @@
|
||||
* 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.query.spi;
|
||||
package org.hibernate.query.named;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.spi.QueryParameterImplementor;
|
||||
|
||||
/**
|
||||
* Named Query mementos are stored in the QueryEngine's
|
@ -1,10 +1,10 @@
|
||||
/*
|
||||
* 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>.
|
||||
* 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.query.spi;
|
||||
package org.hibernate.query.named;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
@ -13,6 +13,7 @@
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.procedure.spi.NamedCallableQueryMemento;
|
||||
import org.hibernate.query.hql.spi.NamedHqlQueryMemento;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.sql.spi.NamedNativeQueryMemento;
|
||||
|
||||
/**
|
@ -4,9 +4,10 @@
|
||||
* 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.query.spi;
|
||||
package org.hibernate.query.named;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.query.spi.ResultSetMapping;
|
||||
|
||||
/**
|
||||
* Used to keep information about named result mappings defined by the
|
@ -4,7 +4,7 @@
|
||||
* 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.query.spi;
|
||||
package org.hibernate.query.named;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
@ -63,8 +63,8 @@
|
||||
import org.hibernate.query.TupleTransformer;
|
||||
import org.hibernate.query.TypedParameterValue;
|
||||
import org.hibernate.query.internal.ScrollableResultsIterator;
|
||||
import org.hibernate.query.named.NamedQueryMemento;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
|
||||
import static org.hibernate.LockOptions.WAIT_FOREVER;
|
||||
|
@ -20,13 +20,14 @@
|
||||
import org.hibernate.query.QueryLogger;
|
||||
import org.hibernate.query.internal.QueryInterpretationCacheDisabledImpl;
|
||||
import org.hibernate.query.internal.QueryInterpretationCacheStandardImpl;
|
||||
import org.hibernate.query.named.NamedQueryRepository;
|
||||
import org.hibernate.query.sqm.internal.SqmCriteriaNodeBuilder;
|
||||
import org.hibernate.query.hql.SemanticQueryProducer;
|
||||
import org.hibernate.query.sqm.produce.function.SqmFunctionRegistry;
|
||||
import org.hibernate.query.hql.internal.SemanticQueryProducerImpl ;
|
||||
import org.hibernate.query.sqm.internal.SqmCreationOptionsStandard;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationContext;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationOptions;
|
||||
import org.hibernate.query.hql.spi.SqmCreationOptions;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
|
||||
/**
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.QueryParameter;
|
||||
import org.hibernate.query.named.NamedQueryMemento;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
@ -7,6 +7,7 @@
|
||||
package org.hibernate.query.spi;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.query.named.NamedResultSetMappingMemento;
|
||||
import org.hibernate.sql.results.spi.DomainResultProducer;
|
||||
|
||||
/**
|
||||
|
@ -11,9 +11,8 @@
|
||||
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.query.spi.AbstractNamedQueryMemento;
|
||||
import org.hibernate.query.named.AbstractNamedQueryMemento;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.sql.spi.NamedNativeQueryMemento;
|
||||
import org.hibernate.query.sql.spi.NativeQueryImplementor;
|
||||
|
@ -12,8 +12,8 @@
|
||||
import org.hibernate.boot.spi.NamedNativeQueryDefinition;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.query.spi.AbstractNamedQueryMemento;
|
||||
import org.hibernate.query.spi.NamedQueryMemento;
|
||||
import org.hibernate.query.named.AbstractNamedQueryMemento;
|
||||
import org.hibernate.query.named.NamedQueryMemento;
|
||||
import org.hibernate.query.sql.internal.NamedNativeQueryMementoImpl;
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,7 @@
|
||||
import org.hibernate.query.QueryParameter;
|
||||
import org.hibernate.query.ResultListTransformer;
|
||||
import org.hibernate.query.TupleTransformer;
|
||||
import org.hibernate.query.spi.NameableQuery;
|
||||
import org.hibernate.query.named.NameableQuery;
|
||||
import org.hibernate.query.spi.QueryImplementor;
|
||||
|
||||
/**
|
||||
|
@ -7,7 +7,7 @@
|
||||
package org.hibernate.query.sql.spi;
|
||||
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.query.spi.NamedResultSetMappingMemento;
|
||||
import org.hibernate.query.named.NamedResultSetMappingMemento;
|
||||
import org.hibernate.query.spi.QueryResultBuilder;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* 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.query.sqm.spi;
|
||||
package org.hibernate.query.sqm;
|
||||
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.query.sqm.tree.delete.SqmDeleteStatement;
|
@ -6,14 +6,20 @@
|
||||
*/
|
||||
package org.hibernate.query.sqm;
|
||||
|
||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
|
||||
/**
|
||||
* Anything in the application domain model that can be used in an
|
||||
* SQM query as an expression
|
||||
*
|
||||
* @see SqmExpression#getNodeType
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface SqmExpressable<J> {
|
||||
/**
|
||||
* The Java type descriptor for this expressable
|
||||
*/
|
||||
JavaTypeDescriptor<J> getExpressableJavaTypeDescriptor();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
package org.hibernate.query.sqm;
|
||||
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.from.SqmAttributeJoin;
|
||||
import org.hibernate.query.sqm.tree.from.SqmFrom;
|
||||
|
@ -10,7 +10,7 @@
|
||||
import javax.persistence.metamodel.Bindable;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.DomainType;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
|
||||
/**
|
||||
|
@ -4,7 +4,7 @@
|
||||
* 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.query.sqm.spi;
|
||||
package org.hibernate.query.sqm;
|
||||
|
||||
import org.hibernate.Internal;
|
||||
import org.hibernate.query.QueryLogger;
|
||||
@ -16,6 +16,7 @@
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Internal
|
||||
public interface SqmTreeCreationLogger {
|
||||
String LOGGER_NAME = QueryLogger.subLoggerName( "sqm.creation" );
|
@ -9,7 +9,7 @@
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.query.sqm.spi.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.tree.AbstractSqmNode;
|
||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||
import org.hibernate.query.sqm.tree.SqmVisitableNode;
|
||||
|
@ -15,7 +15,7 @@
|
||||
import org.hibernate.query.criteria.JpaCoalesce;
|
||||
import org.hibernate.query.criteria.JpaExpression;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.spi.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.produce.function.SqmFunctionTemplate;
|
||||
import org.hibernate.query.sqm.tree.expression.AbstractSqmExpression;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.query.sqm.spi.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.tree.AbstractSqmNode;
|
||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||
import org.hibernate.query.sqm.tree.SqmVisitableNode;
|
||||
|
@ -9,7 +9,7 @@
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.query.sqm.spi.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.tree.AbstractSqmNode;
|
||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||
import org.hibernate.query.sqm.tree.SqmVisitableNode;
|
||||
|
@ -7,7 +7,7 @@
|
||||
package org.hibernate.query.sqm.function;
|
||||
|
||||
import org.hibernate.query.criteria.JpaFunction;
|
||||
import org.hibernate.query.sqm.spi.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||
import org.hibernate.sql.results.spi.DomainResultProducer;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
package org.hibernate.query.sqm.function;
|
||||
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.spi.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.tree.expression.AbstractSqmExpression;
|
||||
import org.hibernate.sql.results.spi.DomainResultProducer;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
import org.hibernate.query.TrimSpec;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.query.sqm.spi.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.tree.AbstractSqmNode;
|
||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||
import org.hibernate.query.sqm.tree.SqmVisitableNode;
|
||||
|
@ -20,6 +20,8 @@
|
||||
import org.hibernate.query.spi.QueryParameterImplementor;
|
||||
import org.hibernate.query.spi.ScrollableResultsImplementor;
|
||||
import org.hibernate.query.spi.SelectQueryPlan;
|
||||
import org.hibernate.query.sqm.sql.internal.SqmSelectInterpretation;
|
||||
import org.hibernate.query.sqm.sql.internal.SqmSelectToSqlAstConverter;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
||||
import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
|
||||
import org.hibernate.query.sqm.tree.select.SqmSelection;
|
||||
@ -143,7 +145,15 @@ public List<R> performList(ExecutionContext executionContext) {
|
||||
throw new NotYetImplementedFor6Exception( getClass() );
|
||||
|
||||
// if ( jdbcSelect == null ) {
|
||||
// final SqmSelectToSqlAstConverter sqmConverter = getSqmSelectToSqlAstConverter( executionContext );
|
||||
// // todo (6.0) : for cases where we have no "load query influencers" we could use a cached SQL AST
|
||||
// // - this is similar to the plan for loaders
|
||||
// final SqmSelectToSqlAstConverter sqmConverter = new SqmSelectToSqlAstConverter(
|
||||
// executionContext.getQueryOptions(),
|
||||
// domainParameterXref,
|
||||
// executionContext.getDomainParameterBindingContext().getQueryParameterBindings(),
|
||||
// executionContext.getLoadQueryInfluencers(),
|
||||
// executionContext.getSession().getFactory()
|
||||
// );
|
||||
// final SqmSelectInterpretation interpretation = sqmConverter.interpret( sqm );
|
||||
// jdbcSelect = SqlAstSelectToJdbcSelectConverter.interpret(
|
||||
// interpretation,
|
||||
@ -152,6 +162,7 @@ public List<R> performList(ExecutionContext executionContext) {
|
||||
//
|
||||
// this.jdbcParamsXref = SqmConsumeHelper.generateJdbcParamsXref( domainParameterXref, interpretation );
|
||||
// }
|
||||
|
||||
//
|
||||
// final JdbcParameterBindings jdbcParameterBindings = QueryHelper.createJdbcParameterBindings(
|
||||
// executionContext.getDomainParameterBindingContext().getQueryParameterBindings(),
|
||||
|
@ -184,6 +184,10 @@ public String getQueryString() {
|
||||
return hqlString;
|
||||
}
|
||||
|
||||
public DomainParameterXref getDomainParameterXref() {
|
||||
return domainParameterXref;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Query<R> applyGraph(RootGraph graph, GraphSemantic semantic) {
|
||||
queryOptions.applyGraph( (RootGraphImplementor<?>) graph, semantic );
|
||||
@ -197,6 +201,7 @@ protected void applyEntityGraphQueryHint(String hintName, RootGraphImplementor e
|
||||
applyGraph( entityGraph, graphSemantic );
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmStatement getSqmStatement() {
|
||||
return sqmStatement;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
package org.hibernate.query.sqm.internal;
|
||||
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationOptions;
|
||||
import org.hibernate.query.hql.spi.SqmCreationOptions;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
@ -7,9 +7,9 @@
|
||||
package org.hibernate.query.sqm.internal;
|
||||
|
||||
import org.hibernate.query.hql.internal.SqmPathRegistryImpl;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmPathRegistry;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.SqmQuery;
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
package org.hibernate.query.sqm.internal;
|
||||
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.SqmQuery;
|
||||
|
||||
/**
|
||||
|
@ -6,9 +6,9 @@
|
||||
*/
|
||||
package org.hibernate.query.sqm.internal;
|
||||
|
||||
import org.hibernate.query.sqm.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.sqm.spi.SqmQuerySpecCreationProcessingState;
|
||||
import org.hibernate.query.sqm.spi.SqmCreationState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmQuerySpecCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.tree.select.SqmSelectQuery;
|
||||
import org.hibernate.query.sqm.tree.select.SqmSelection;
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.query.QueryLogger;
|
||||
import org.hibernate.query.sqm.spi.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.tree.SqmStatement;
|
||||
import org.hibernate.query.sqm.tree.delete.SqmDeleteStatement;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmBasicValuedSimplePath;
|
||||
|
@ -7,6 +7,7 @@
|
||||
package org.hibernate.query.sqm.spi;
|
||||
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.function.SqmCastTarget;
|
||||
import org.hibernate.query.sqm.function.SqmDistinct;
|
||||
import org.hibernate.query.sqm.function.SqmExtractUnit;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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.query.sqm.sql;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
|
||||
/**
|
||||
* Indicates a problem converting an SQM tree to a SQL AST
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class ConversionException extends HibernateException {
|
||||
public ConversionException(String message) {
|
||||
super( message );
|
||||
}
|
||||
|
||||
public ConversionException(String message, Throwable cause) {
|
||||
super( message, cause );
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
|
||||
*/
|
||||
|
||||
package org.hibernate.query.sqm.spi;
|
||||
package org.hibernate.query.sqm.sql;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
@ -4,20 +4,24 @@
|
||||
* 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.sql.ast.spi;
|
||||
package org.hibernate.query.sqm.sql;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.sql.ast.spi.SqlAliasBase;
|
||||
import org.hibernate.sql.ast.spi.SqlAliasBaseGenerator;
|
||||
|
||||
/**
|
||||
* Helper used in creating unique SQL table aliases for a SQL AST
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class SqlAliasBaseManager {
|
||||
public class SqlAliasBaseManager implements SqlAliasBaseGenerator {
|
||||
// work dictionary used to map an acronym to the number of times it has been used.
|
||||
private Map<String,Integer> acronymCountMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public SqlAliasBase createSqlAliasBase(String stem) {
|
||||
Integer acronymCount = acronymCountMap.get( stem );
|
||||
if ( acronymCount == null ) {
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user