Top Description Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.tools.resolver

public Class SubqueryEntityResolver

extends Resolver
Class Inheritance
Imports
org.eclipse.persistence.jpa.jpql.BaseDeclarationIdentificationVariableFinder, org.eclipse.persistence.jpa.jpql.parser.AbstractSchemaName, org.eclipse.persistence.jpa.jpql.tools.JPQLQueryContext, org.eclipse.persistence.jpa.jpql.tools.spi.IManagedType, .IMapping, .IType, .ITypeDeclaration

This Resolver retrieves the type for an abstract schema name (entity name) if it can be resolved otherwise a derived path will be assumed. This Resolver is used within a subquery and it handles the following two cases.

The "root" object in the subquery is an unqualified derived path:

 UPDATE Employee SET name = 'JPQL'
WHERE (SELECT a FROM addr a)
and The "root" object in the subquery is an entity:
 UPDATE Employee SET name = 'JPQL'
WHERE (SELECT a FROM Address a)
Author
Pascal Filion
Since
2.5
Version
2.5

Field Summary

Modifier and TypeField and Description
private AbstractSchemaName
abstractSchemaName

The AbstractSchemaName holding onto the the name of the entity.

private Resolver
derivedPathResolver

The actual Resolver when the abstract schema name is actually an unqualified derived path expression.

private String
entityName

The name of the entity or the unqualified derived path.

private IManagedType
managedType

The IManagedType with the same abstract schema name.

private boolean
managedTypeResolved

Determines whether the managed type was resolved or not.

private JPQLQueryContext
queryContext

The JPQLQueryContext for the subquery.

Constructor Summary

AccessConstructor and Description
public
SubqueryEntityResolver(Resolver
The parent Resolver, which is never null
parent
,
JPQLQueryContext
The JPQLQueryContext for the subquery
queryContext
,
AbstractSchemaName
The AbstractSchemaName holding onto the the name of the entity
abstractSchemaName
)

Creates a new DerivedPathResolver.

Method Summary

Modifier and TypeMethod and Description
protected IType
buildType()

Overrides org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver.buildType.

Resolves the IType of the property handled by this Resolver.
protected ITypeDeclaration
public String

Returns:

The entity name, which is never null
getAbstractSchemaName
()

Returns the name of the entity to resolve.

public IManagedType
getManagedType()

Overrides org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver.getManagedType.

Returns the IManagedType associated with the field handled by this Resolver.
public IMapping
protected Resolver

Returns:

A non-null Resolver
resolveDerivePathResolver
()

Creates the Resolver for a unqualified derived path expression.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver:
addChildcheckParentgetChildgetParentgetParentManagedTypegetParentMappinggetParentTypegetParentTypeDeclarationgetProvidergetQuerygetTypegetTypegetTypegetTypeDeclarationgetTypeHelpergetTypeRepositoryisNullAllowedsetNullAllowed

Field Detail

abstractSchemaNameback to summary
private AbstractSchemaName abstractSchemaName

The AbstractSchemaName holding onto the the name of the entity.

derivedPathResolverback to summary
private Resolver derivedPathResolver

The actual Resolver when the abstract schema name is actually an unqualified derived path expression.

entityNameback to summary
private String entityName

The name of the entity or the unqualified derived path.

managedTypeback to summary
private IManagedType managedType

The IManagedType with the same abstract schema name.

managedTypeResolvedback to summary
private boolean managedTypeResolved

Determines whether the managed type was resolved or not.

queryContextback to summary
private JPQLQueryContext queryContext

The JPQLQueryContext for the subquery.

Constructor Detail

SubqueryEntityResolverback to summary
public SubqueryEntityResolver(Resolver parent, JPQLQueryContext queryContext, AbstractSchemaName abstractSchemaName)

Creates a new DerivedPathResolver.

Parameters
parent:Resolver

The parent Resolver, which is never null

queryContext:JPQLQueryContext

The JPQLQueryContext for the subquery

abstractSchemaName:AbstractSchemaName

The AbstractSchemaName holding onto the the name of the entity

Method Detail

buildTypeback to summary
protected IType buildType()

Overrides org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver.buildType.

Doc from org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver.buildType.

Resolves the IType of the property handled by this Resolver.

Returns:IType

Either the IType that was resolved by this Resolver or the IType for IType#UNRESOLVABLE_TYPE if it could not be resolved

Annotations
@Override
buildTypeDeclarationback to summary
protected ITypeDeclaration buildTypeDeclaration()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver.buildTypeDeclaration.

Doc from org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver.buildTypeDeclaration.

Resolves the ITypeDeclaration of the property handled by this Resolver.

Returns:ITypeDeclaration

Either the ITypeDeclaration that was resolved by this Resolver or the ITypeDeclaration for IType#UNRESOLVABLE_TYPE if it could not be resolved

Annotations
@Override
getAbstractSchemaNameback to summary
public String getAbstractSchemaName()

Returns the name of the entity to resolve.

Returns:String

The entity name, which is never null

getManagedTypeback to summary
public IManagedType getManagedType()

Overrides org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver.getManagedType.

Doc from org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver.getManagedType.

Returns the IManagedType associated with the field handled by this Resolver. If this Resolver does not handle a field that has a IManagedType, then null should be returned.

For example: "SELECT e FROM Employee e", the Resolver for e would be returning the IManagedType for Employee.

Returns:IManagedType

Either the IManagedType, if it could be resolved; null otherwise

Annotations
@Override
getMappingback to summary
public IMapping getMapping()

Overrides org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver.getMapping.

Doc from org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver.getMapping.

Returns the IMapping for the wrapped field.

Returns:IMapping

Either the IMapping or null if none exists

Annotations
@Override
resolveDerivePathResolverback to summary
protected Resolver resolveDerivePathResolver()

Creates the Resolver for a unqualified derived path expression.

Returns:Resolver

A non-null Resolver

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override