6 - SQM based on JPA type system
This commit is contained in:
parent
2748b34a11
commit
05724fc19a
|
@ -353,7 +353,7 @@ public class MetamodelImpl implements MetamodelImplementor, Serializable {
|
||||||
final RootGraphImpl entityGraph = new RootGraphImpl(
|
final RootGraphImpl entityGraph = new RootGraphImpl(
|
||||||
definition.getRegisteredName(),
|
definition.getRegisteredName(),
|
||||||
entityType,
|
entityType,
|
||||||
this.getSessionFactory()
|
this
|
||||||
);
|
);
|
||||||
|
|
||||||
final NamedEntityGraph namedEntityGraph = definition.getAnnotation();
|
final NamedEntityGraph namedEntityGraph = definition.getAnnotation();
|
||||||
|
@ -478,7 +478,7 @@ public class MetamodelImpl implements MetamodelImplementor, Serializable {
|
||||||
javaTypeDescriptor,
|
javaTypeDescriptor,
|
||||||
superType,
|
superType,
|
||||||
persistentClass,
|
persistentClass,
|
||||||
context.getSessionFactory()
|
context.getSessionFactory().getMetamodel()
|
||||||
);
|
);
|
||||||
|
|
||||||
context.registerEntityType( persistentClass, entityType );
|
context.registerEntityType( persistentClass, entityType );
|
||||||
|
@ -520,7 +520,7 @@ public class MetamodelImpl implements MetamodelImplementor, Serializable {
|
||||||
javaTypeDescriptor,
|
javaTypeDescriptor,
|
||||||
mappedSuperclass,
|
mappedSuperclass,
|
||||||
superType,
|
superType,
|
||||||
context.getSessionFactory()
|
context.getSessionFactory().getMetamodel()
|
||||||
);
|
);
|
||||||
context.registerMappedSuperclassType( mappedSuperclass, mappedSuperclassType );
|
context.registerMappedSuperclassType( mappedSuperclass, mappedSuperclassType );
|
||||||
return mappedSuperclassType;
|
return mappedSuperclassType;
|
||||||
|
|
|
@ -9,23 +9,33 @@ package org.hibernate.metamodel.model.domain.internal;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.NotYetImplementedFor6Exception;
|
import org.hibernate.NotYetImplementedFor6Exception;
|
||||||
|
import org.hibernate.metamodel.ValueClassification;
|
||||||
import org.hibernate.metamodel.model.domain.MapPersistentAttribute;
|
import org.hibernate.metamodel.model.domain.MapPersistentAttribute;
|
||||||
import org.hibernate.metamodel.model.domain.SimpleDomainType;
|
import org.hibernate.metamodel.model.domain.SimpleDomainType;
|
||||||
import org.hibernate.query.sqm.SqmPathSource;
|
import org.hibernate.query.sqm.SqmPathSource;
|
||||||
import org.hibernate.query.sqm.produce.path.spi.SemanticPathPart;
|
|
||||||
import org.hibernate.query.sqm.produce.spi.SqmCreationState;
|
import org.hibernate.query.sqm.produce.spi.SqmCreationState;
|
||||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
import org.hibernate.query.sqm.tree.domain.SqmMapJoin;
|
||||||
|
import org.hibernate.query.sqm.tree.from.SqmAttributeJoin;
|
||||||
|
import org.hibernate.query.sqm.tree.from.SqmFrom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
class MapAttributeImpl<X, K, V> extends AbstractPluralAttribute<X, Map<K, V>, V> implements MapPersistentAttribute<X, K, V> {
|
class MapAttributeImpl<X, K, V> extends AbstractPluralAttribute<X, Map<K, V>, V> implements MapPersistentAttribute<X, K, V> {
|
||||||
private final SimpleDomainType<K> keyType;
|
private final SqmPathSource<K> keyPathSource;
|
||||||
|
|
||||||
MapAttributeImpl(PluralAttributeBuilder<X, Map<K, V>, V, K> xceBuilder) {
|
MapAttributeImpl(PluralAttributeBuilder<X, Map<K, V>, V, K> xceBuilder) {
|
||||||
super( xceBuilder );
|
super( xceBuilder );
|
||||||
this.keyType = xceBuilder.getKeyType();
|
|
||||||
|
//noinspection unchecked
|
||||||
|
this.keyPathSource = (SqmPathSource) DomainModelHelper.resolveSqmPathSource(
|
||||||
|
ValueClassification.BASIC,
|
||||||
|
getName(),
|
||||||
|
xceBuilder.getListIndexOrMapKeyType(),
|
||||||
|
BindableType.PLURAL_ATTRIBUTE,
|
||||||
|
xceBuilder.getNodeBuilder()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,12 +45,17 @@ class MapAttributeImpl<X, K, V> extends AbstractPluralAttribute<X, Map<K, V>, V>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<K> getKeyJavaType() {
|
public Class<K> getKeyJavaType() {
|
||||||
return keyType.getJavaType();
|
return keyPathSource.getBindableJavaType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SqmPathSource getKeyPathSource() {
|
||||||
|
return keyPathSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SimpleDomainType<K> getKeyType() {
|
public SimpleDomainType<K> getKeyType() {
|
||||||
return keyType;
|
return (SimpleDomainType<K>) keyPathSource.getSqmPathType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -54,20 +69,15 @@ class MapAttributeImpl<X, K, V> extends AbstractPluralAttribute<X, Map<K, V>, V>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SemanticPathPart resolvePathPart(
|
public SqmAttributeJoin createSqmJoin(
|
||||||
String name,
|
SqmFrom lhs, SqmJoinType joinType, String alias, boolean fetched, SqmCreationState creationState) {
|
||||||
String currentContextKey,
|
return new SqmMapJoin(
|
||||||
boolean isTerminal,
|
lhs,
|
||||||
SqmCreationState creationState) {
|
this,
|
||||||
throw new NotYetImplementedFor6Exception();
|
alias,
|
||||||
}
|
joinType,
|
||||||
|
fetched,
|
||||||
@Override
|
creationState.getCreationContext().getNodeBuilder()
|
||||||
public SqmPath resolveIndexedAccess(
|
);
|
||||||
SqmExpression selector,
|
|
||||||
String currentContextKey,
|
|
||||||
boolean isTerminal,
|
|
||||||
SqmCreationState creationState) {
|
|
||||||
throw new NotYetImplementedFor6Exception();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue