Named Query javadoc
This commit is contained in:
parent
704896614d
commit
dc85c75bce
|
@ -11,7 +11,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.loader.ast.spi.SingleIdEntityLoader;
|
import org.hibernate.loader.ast.spi.SingleIdEntityLoader;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.query.named.NamedQueryProducer;
|
import org.hibernate.query.named.NamedQueryMemento;
|
||||||
import org.hibernate.query.named.NamedQueryRepository;
|
import org.hibernate.query.named.NamedQueryRepository;
|
||||||
import org.hibernate.query.spi.QueryImplementor;
|
import org.hibernate.query.spi.QueryImplementor;
|
||||||
import org.hibernate.query.sql.spi.NamedNativeQueryMemento;
|
import org.hibernate.query.sql.spi.NamedNativeQueryMemento;
|
||||||
|
@ -24,7 +24,7 @@ import org.hibernate.query.sql.spi.NamedNativeQueryMemento;
|
||||||
*/
|
*/
|
||||||
public class SingleIdEntityLoaderProvidedQueryImpl<T> implements SingleIdEntityLoader<T> {
|
public class SingleIdEntityLoaderProvidedQueryImpl<T> implements SingleIdEntityLoader<T> {
|
||||||
private final EntityMappingType entityDescriptor;
|
private final EntityMappingType entityDescriptor;
|
||||||
private final NamedQueryProducer namedQueryMemento;
|
private final NamedQueryMemento namedQueryMemento;
|
||||||
|
|
||||||
public SingleIdEntityLoaderProvidedQueryImpl(
|
public SingleIdEntityLoaderProvidedQueryImpl(
|
||||||
EntityMappingType entityDescriptor,
|
EntityMappingType entityDescriptor,
|
||||||
|
@ -38,7 +38,7 @@ public class SingleIdEntityLoaderProvidedQueryImpl<T> implements SingleIdEntityL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static NamedQueryProducer resolveNamedQuery(
|
private static NamedQueryMemento resolveNamedQuery(
|
||||||
String queryName,
|
String queryName,
|
||||||
SessionFactoryImplementor sf) {
|
SessionFactoryImplementor sf) {
|
||||||
final NamedQueryRepository namedQueryRepository = sf.getQueryEngine().getNamedQueryRepository();
|
final NamedQueryRepository namedQueryRepository = sf.getQueryEngine().getNamedQueryRepository();
|
||||||
|
|
|
@ -15,14 +15,14 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.query.hql.internal.NamedHqlQueryMementoImpl;
|
import org.hibernate.query.hql.internal.NamedHqlQueryMementoImpl;
|
||||||
import org.hibernate.query.named.AbstractNamedQueryMemento;
|
import org.hibernate.query.named.AbstractNamedQueryMemento;
|
||||||
import org.hibernate.query.named.NameableQuery;
|
import org.hibernate.query.named.NameableQuery;
|
||||||
import org.hibernate.query.named.NamedQueryProducer;
|
import org.hibernate.query.named.NamedQueryMemento;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NamedQueryMemento for HQL queries
|
* NamedQueryMemento for HQL queries
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface NamedHqlQueryMemento extends NamedQueryProducer {
|
public interface NamedHqlQueryMemento extends NamedQueryMemento {
|
||||||
/**
|
/**
|
||||||
* Informational access to the HQL query string
|
* Informational access to the HQL query string
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -12,12 +12,14 @@ import org.hibernate.CacheMode;
|
||||||
import org.hibernate.FlushMode;
|
import org.hibernate.FlushMode;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.query.spi.QueryEngine;
|
import org.hibernate.query.spi.QueryEngine;
|
||||||
|
import org.hibernate.query.spi.QueryImplementor;
|
||||||
import org.hibernate.query.spi.QueryParameterImplementor;
|
import org.hibernate.query.spi.QueryParameterImplementor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Named Query mementos are stored in the QueryEngine's
|
* The runtime representation of named queries. They are stored in and
|
||||||
* {@link NamedQueryRepository}. This is the base contract
|
* available through the QueryEngine's {@link NamedQueryRepository}.
|
||||||
* for all specific types of named query mementos
|
*
|
||||||
|
* This is the base contract for all specific types of named query mementos
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@ -27,11 +29,6 @@ public interface NamedQueryMemento {
|
||||||
*/
|
*/
|
||||||
String getRegistrationName();
|
String getRegistrationName();
|
||||||
|
|
||||||
/**
|
|
||||||
* Makes a copy of the memento
|
|
||||||
*/
|
|
||||||
NamedQueryMemento makeCopy(String name);
|
|
||||||
|
|
||||||
Boolean getCacheable();
|
Boolean getCacheable();
|
||||||
|
|
||||||
String getCacheRegion();
|
String getCacheRegion();
|
||||||
|
@ -52,6 +49,14 @@ public interface NamedQueryMemento {
|
||||||
|
|
||||||
void validate(QueryEngine queryEngine);
|
void validate(QueryEngine queryEngine);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes a copy of the memento using the specified registration name
|
||||||
|
*/
|
||||||
|
NamedQueryMemento makeCopy(String name);
|
||||||
|
|
||||||
|
QueryImplementor<?> toQuery(SharedSessionContractImplementor session);
|
||||||
|
<T> QueryImplementor<T> toQuery(SharedSessionContractImplementor session, Class<T> javaType);
|
||||||
|
|
||||||
interface ParameterMemento {
|
interface ParameterMemento {
|
||||||
QueryParameterImplementor resolve(SharedSessionContractImplementor session);
|
QueryParameterImplementor resolve(SharedSessionContractImplementor session);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +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.query.named;
|
|
||||||
|
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
|
||||||
import org.hibernate.query.spi.QueryImplementor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specialization of NamedQueryMemento for mementos which can produce
|
|
||||||
* {@link org.hibernate.query.spi.QueryImplementor} implementations
|
|
||||||
*
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*/
|
|
||||||
public interface NamedQueryProducer extends NamedQueryMemento {
|
|
||||||
QueryImplementor<?> toQuery(SharedSessionContractImplementor session);
|
|
||||||
<T> QueryImplementor<T> toQuery(SharedSessionContractImplementor session, Class<T> javaType);
|
|
||||||
}
|
|
|
@ -20,6 +20,10 @@ import org.hibernate.query.spi.QueryEngine;
|
||||||
import org.hibernate.query.sql.spi.NamedNativeQueryMemento;
|
import org.hibernate.query.sql.spi.NamedNativeQueryMemento;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Repository for references to named things related with queries. This includes
|
||||||
|
* named HQL, JPAQL, native and procedure queries as well as named result-set
|
||||||
|
* mappings
|
||||||
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@Incubating
|
@Incubating
|
||||||
|
|
|
@ -28,7 +28,15 @@ import org.hibernate.query.results.ResultSetMapping;
|
||||||
*/
|
*/
|
||||||
@Incubating
|
@Incubating
|
||||||
public interface NamedResultSetMappingMemento {
|
public interface NamedResultSetMappingMemento {
|
||||||
|
/**
|
||||||
|
* The name associated with this memento
|
||||||
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolve this memento. Generally speaking, this involves building ResultBuilder instances for
|
||||||
|
* each defined result and registering them with the passed `resultSetMapping`. Any known
|
||||||
|
* query spaces should be passed to the `querySpaceConsumer`
|
||||||
|
*/
|
||||||
void resolve(ResultSetMapping resultSetMapping, Consumer<String> querySpaceConsumer, SessionFactoryImplementor sessionFactory);
|
void resolve(ResultSetMapping resultSetMapping, Consumer<String> querySpaceConsumer, SessionFactoryImplementor sessionFactory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,12 @@ package org.hibernate.query.sql.spi;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
|
||||||
import org.hibernate.boot.query.NamedNativeQueryDefinition;
|
import org.hibernate.boot.query.NamedNativeQueryDefinition;
|
||||||
|
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.query.named.AbstractNamedQueryMemento;
|
import org.hibernate.query.named.AbstractNamedQueryMemento;
|
||||||
import org.hibernate.query.named.NamedQueryProducer;
|
import org.hibernate.query.named.NamedQueryMemento;
|
||||||
import org.hibernate.query.sql.internal.NamedNativeQueryMementoImpl;
|
import org.hibernate.query.sql.internal.NamedNativeQueryMementoImpl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,7 +21,7 @@ import org.hibernate.query.sql.internal.NamedNativeQueryMementoImpl;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface NamedNativeQueryMemento extends NamedQueryProducer {
|
public interface NamedNativeQueryMemento extends NamedQueryMemento {
|
||||||
/**
|
/**
|
||||||
* Informational access to the SQL query string
|
* Informational access to the SQL query string
|
||||||
*/
|
*/
|
||||||
|
@ -35,11 +35,13 @@ public interface NamedNativeQueryMemento extends NamedQueryProducer {
|
||||||
/**
|
/**
|
||||||
* Convert the memento into an untyped executable query
|
* Convert the memento into an untyped executable query
|
||||||
*/
|
*/
|
||||||
NativeQueryImplementor toQuery(SharedSessionContractImplementor session);
|
@Override
|
||||||
|
NativeQueryImplementor<?> toQuery(SharedSessionContractImplementor session);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the memento into a typed executable query
|
* Convert the memento into a typed executable query
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
<T> NativeQueryImplementor<T> toQuery(SharedSessionContractImplementor session, Class<T> resultType);
|
<T> NativeQueryImplementor<T> toQuery(SharedSessionContractImplementor session, Class<T> resultType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue