fix some warnings and clean up some typing issues
this is a general cleanup of the Session + Query hierarchies
This commit is contained in:
parent
b91944c09a
commit
a1e3f0cd6f
|
@ -6,7 +6,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate;
|
package org.hibernate;
|
||||||
|
|
||||||
import java.io.Closeable;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.persistence.EntityGraph;
|
import jakarta.persistence.EntityGraph;
|
||||||
import jakarta.persistence.EntityManager;
|
import jakarta.persistence.EntityManager;
|
||||||
|
@ -14,7 +13,6 @@ import jakarta.persistence.FlushModeType;
|
||||||
import jakarta.persistence.criteria.CriteriaDelete;
|
import jakarta.persistence.criteria.CriteriaDelete;
|
||||||
import jakarta.persistence.criteria.CriteriaQuery;
|
import jakarta.persistence.criteria.CriteriaQuery;
|
||||||
import jakarta.persistence.criteria.CriteriaUpdate;
|
import jakarta.persistence.criteria.CriteriaUpdate;
|
||||||
|
|
||||||
import org.hibernate.graph.RootGraph;
|
import org.hibernate.graph.RootGraph;
|
||||||
import org.hibernate.stat.SessionStatistics;
|
import org.hibernate.stat.SessionStatistics;
|
||||||
|
|
||||||
|
@ -79,7 +77,7 @@ import org.hibernate.stat.SessionStatistics;
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface Session extends SharedSessionContract, EntityManager, AutoCloseable, Closeable {
|
public interface Session extends SharedSessionContract, EntityManager {
|
||||||
/**
|
/**
|
||||||
* Obtain a {@link Session} builder with the ability to grab certain information from this session.
|
* Obtain a {@link Session} builder with the ability to grab certain information from this session.
|
||||||
*
|
*
|
||||||
|
@ -956,9 +954,8 @@ public interface Session extends SharedSessionContract, EntityManager, AutoClose
|
||||||
RootGraph<?> getEntityGraph(String graphName);
|
RootGraph<?> getEntityGraph(String graphName);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({"unchecked", "RedundantCast"})
|
|
||||||
default <T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> entityClass) {
|
default <T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> entityClass) {
|
||||||
return (List) getSessionFactory().findEntityGraphsByType( entityClass );
|
return getSessionFactory().findEntityGraphsByType( entityClass );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1092,21 +1089,36 @@ public interface Session extends SharedSessionContract, EntityManager, AutoClose
|
||||||
*/
|
*/
|
||||||
void addEventListeners(SessionEventListener... listeners);
|
void addEventListeners(SessionEventListener... listeners);
|
||||||
|
|
||||||
@Override
|
// The following declarations just override the JPA return type with our
|
||||||
<T> org.hibernate.query.Query<T> createQuery(String queryString, Class<T> resultType);
|
// Hibernate Query type, as required by the declaration in QueryProducer
|
||||||
|
|
||||||
// Override the JPA return type with the one exposed in QueryProducer
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
@Override
|
org.hibernate.query.Query getNamedQuery(String queryString);
|
||||||
<T> org.hibernate.query.Query<T> createQuery(CriteriaQuery<T> criteriaQuery);
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
org.hibernate.query.Query createQuery(String queryString);
|
||||||
|
|
||||||
// Override the JPA return type with the one exposed in QueryProducer
|
|
||||||
@Override
|
@Override
|
||||||
|
<R> org.hibernate.query.Query<R> createQuery(String queryString, Class<R> resultType);
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
org.hibernate.query.Query createNamedQuery(String queryString);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
<R> org.hibernate.query.Query<R> createNamedQuery(String name, Class<R> resultType);
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
org.hibernate.query.NativeQuery createNativeQuery(String queryString);
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
org.hibernate.query.NativeQuery createNativeQuery(String queryString, String resultSetMappingName);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
<R> org.hibernate.query.Query<R> createQuery(CriteriaQuery<R> criteriaQuery);
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
org.hibernate.query.Query createQuery(CriteriaUpdate updateQuery);
|
org.hibernate.query.Query createQuery(CriteriaUpdate updateQuery);
|
||||||
|
|
||||||
// Override the JPA return type with the one exposed in QueryProducer
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
@Override
|
|
||||||
org.hibernate.query.Query createQuery(CriteriaDelete deleteQuery);
|
org.hibernate.query.Query createQuery(CriteriaDelete deleteQuery);
|
||||||
|
|
||||||
|
|
||||||
<T> org.hibernate.query.Query<T> createNamedQuery(String name, Class<T> resultType);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,30 +6,23 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate;
|
package org.hibernate;
|
||||||
|
|
||||||
|
import java.io.Closeable;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import jakarta.persistence.StoredProcedureQuery;
|
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.CriteriaDelete;
|
|
||||||
import jakarta.persistence.criteria.CriteriaQuery;
|
|
||||||
import jakarta.persistence.criteria.CriteriaUpdate;
|
|
||||||
|
|
||||||
import org.hibernate.jdbc.ReturningWork;
|
import org.hibernate.jdbc.ReturningWork;
|
||||||
import org.hibernate.jdbc.Work;
|
import org.hibernate.jdbc.Work;
|
||||||
import org.hibernate.procedure.ProcedureCall;
|
import org.hibernate.procedure.ProcedureCall;
|
||||||
import org.hibernate.query.QueryProducer;
|
import org.hibernate.query.QueryProducer;
|
||||||
import org.hibernate.query.UnknownSqlResultSetMappingException;
|
|
||||||
import org.hibernate.query.criteria.HibernateCriteriaBuilder;
|
import org.hibernate.query.criteria.HibernateCriteriaBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contract methods shared between {@link Session} and {@link StatelessSession}.
|
* Declares operations that are common between {@link Session} and {@link StatelessSession}.
|
||||||
* <p/>
|
*
|
||||||
* NOTE : Poorly named. "shared" simply indicates that its a unified contract between {@link Session} and
|
|
||||||
* {@link StatelessSession}.
|
|
||||||
*
|
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface SharedSessionContract extends QueryProducer, Serializable {
|
public interface SharedSessionContract extends QueryProducer, Closeable, Serializable {
|
||||||
/**
|
/**
|
||||||
* Obtain the tenant identifier associated with this session.
|
* Obtain the tenant identifier associated with this session.
|
||||||
*
|
*
|
||||||
|
@ -77,12 +70,6 @@ public interface SharedSessionContract extends QueryProducer, Serializable {
|
||||||
*/
|
*/
|
||||||
Transaction getTransaction();
|
Transaction getTransaction();
|
||||||
|
|
||||||
@Override
|
|
||||||
org.hibernate.query.Query createQuery(String queryString);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
org.hibernate.query.Query getNamedQuery(String queryName);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a ProcedureCall based on a named template
|
* Gets a ProcedureCall based on a named template
|
||||||
*
|
*
|
||||||
|
@ -112,7 +99,7 @@ public interface SharedSessionContract extends QueryProducer, Serializable {
|
||||||
*
|
*
|
||||||
* @return The representation of the procedure call.
|
* @return The representation of the procedure call.
|
||||||
*/
|
*/
|
||||||
ProcedureCall createStoredProcedureCall(String procedureName, Class... resultClasses);
|
ProcedureCall createStoredProcedureCall(String procedureName, Class<?>... resultClasses);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a call to a stored procedure with specific result set entity mappings.
|
* Creates a call to a stored procedure with specific result set entity mappings.
|
||||||
|
@ -153,7 +140,7 @@ public interface SharedSessionContract extends QueryProducer, Serializable {
|
||||||
*
|
*
|
||||||
* @return The representation of the procedure call.
|
* @return The representation of the procedure call.
|
||||||
*/
|
*/
|
||||||
ProcedureCall createStoredProcedureQuery(String procedureName, Class... resultClasses);
|
ProcedureCall createStoredProcedureQuery(String procedureName, Class<?>... resultClasses);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a call to a stored procedure with specific result set entity mappings.
|
* Creates a call to a stored procedure with specific result set entity mappings.
|
||||||
|
@ -198,17 +185,21 @@ public interface SharedSessionContract extends QueryProducer, Serializable {
|
||||||
* @throws IllegalStateException if the StatelessSession has been closed
|
* @throws IllegalStateException if the StatelessSession has been closed
|
||||||
*/
|
*/
|
||||||
HibernateCriteriaBuilder getCriteriaBuilder();
|
HibernateCriteriaBuilder getCriteriaBuilder();
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
<T> org.hibernate.query.Query<T> createQuery(String queryString, Class<T> resultType);
|
// <T> org.hibernate.query.Query<T> createQuery(String queryString, Class<T> resultType);
|
||||||
|
//
|
||||||
<T> org.hibernate.query.Query<T> createQuery(CriteriaQuery<T> criteriaQuery);
|
// @Override
|
||||||
|
// <T> org.hibernate.query.Query<T> createQuery(CriteriaQuery<T> criteriaQuery);
|
||||||
org.hibernate.query.Query createQuery(CriteriaUpdate updateQuery);
|
//
|
||||||
|
// @Override
|
||||||
org.hibernate.query.Query createQuery(CriteriaDelete deleteQuery);
|
// <R> org.hibernate.query.Query<R> createQuery(CriteriaUpdate<?> updateQuery);
|
||||||
|
//
|
||||||
<T> org.hibernate.query.Query<T> createNamedQuery(String name, Class<T> resultType);
|
// @Override
|
||||||
|
// <R> org.hibernate.query.Query<R> createQuery(CriteriaDelete<?> deleteQuery);
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// <T> org.hibernate.query.Query<T> createNamedQuery(String name, Class<T> resultType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller for allowing users to perform JDBC related work using the Connection managed by this Session.
|
* Controller for allowing users to perform JDBC related work using the Connection managed by this Session.
|
||||||
|
@ -217,7 +208,7 @@ public interface SharedSessionContract extends QueryProducer, Serializable {
|
||||||
* @throws HibernateException Generally indicates wrapped {@link java.sql.SQLException}
|
* @throws HibernateException Generally indicates wrapped {@link java.sql.SQLException}
|
||||||
*/
|
*/
|
||||||
default void doWork(Work work) throws HibernateException {
|
default void doWork(Work work) throws HibernateException {
|
||||||
throw new UnsupportedOperationException( "The doWork method has not been implemented in this implementation of org.hibernate.engine.spi.SharedSessionContractImplemento" );
|
throw new UnsupportedOperationException( "The doWork method has not been implemented in this implementation of org.hibernate.engine.spi.SharedSessionContractImplementor" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -232,7 +223,7 @@ public interface SharedSessionContract extends QueryProducer, Serializable {
|
||||||
* @throws HibernateException Generally indicates wrapped {@link java.sql.SQLException}
|
* @throws HibernateException Generally indicates wrapped {@link java.sql.SQLException}
|
||||||
*/
|
*/
|
||||||
default <T> T doReturningWork(ReturningWork<T> work) throws HibernateException {
|
default <T> T doReturningWork(ReturningWork<T> work) throws HibernateException {
|
||||||
throw new UnsupportedOperationException( "The doReturningWork method has not been implemented in this implementation of org.hibernate.engine.spi.SharedSessionContractImplemento" );
|
throw new UnsupportedOperationException( "The doReturningWork method has not been implemented in this implementation of org.hibernate.engine.spi.SharedSessionContractImplementor" );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate;
|
package org.hibernate;
|
||||||
|
|
||||||
import java.io.Closeable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A command-oriented API for performing bulk operations against a database.
|
* A command-oriented API for performing bulk operations against a database.
|
||||||
* <p/>
|
* <p/>
|
||||||
|
@ -24,7 +22,7 @@ import java.io.Closeable;
|
||||||
*
|
*
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public interface StatelessSession extends SharedSessionContract, AutoCloseable, Closeable {
|
public interface StatelessSession extends SharedSessionContract {
|
||||||
/**
|
/**
|
||||||
* Close the stateless session and release the JDBC connection.
|
* Close the stateless session and release the JDBC connection.
|
||||||
*/
|
*/
|
||||||
|
@ -97,7 +95,7 @@ public interface StatelessSession extends SharedSessionContract, AutoCloseable,
|
||||||
*
|
*
|
||||||
* @return a detached entity instance
|
* @return a detached entity instance
|
||||||
*/
|
*/
|
||||||
Object get(Class entityClass, Object id);
|
<T> T get(Class<T> entityClass, Object id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a row, obtaining the specified lock mode.
|
* Retrieve a row, obtaining the specified lock mode.
|
||||||
|
@ -119,7 +117,7 @@ public interface StatelessSession extends SharedSessionContract, AutoCloseable,
|
||||||
*
|
*
|
||||||
* @return a detached entity instance
|
* @return a detached entity instance
|
||||||
*/
|
*/
|
||||||
Object get(Class entityClass, Object id, LockMode lockMode);
|
<T> T get(Class<T> entityClass, Object id, LockMode lockMode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh the entity instance state from the database.
|
* Refresh the entity instance state from the database.
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.engine.spi;
|
package org.hibernate.engine.spi;
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -16,7 +15,6 @@ import jakarta.persistence.EntityGraph;
|
||||||
import jakarta.persistence.EntityManagerFactory;
|
import jakarta.persistence.EntityManagerFactory;
|
||||||
import jakarta.persistence.FlushModeType;
|
import jakarta.persistence.FlushModeType;
|
||||||
import jakarta.persistence.LockModeType;
|
import jakarta.persistence.LockModeType;
|
||||||
import jakarta.persistence.StoredProcedureQuery;
|
|
||||||
import jakarta.persistence.criteria.CriteriaDelete;
|
import jakarta.persistence.criteria.CriteriaDelete;
|
||||||
import jakarta.persistence.criteria.CriteriaQuery;
|
import jakarta.persistence.criteria.CriteriaQuery;
|
||||||
import jakarta.persistence.criteria.CriteriaUpdate;
|
import jakarta.persistence.criteria.CriteriaUpdate;
|
||||||
|
@ -54,6 +52,7 @@ import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.procedure.ProcedureCall;
|
import org.hibernate.procedure.ProcedureCall;
|
||||||
import org.hibernate.query.criteria.HibernateCriteriaBuilder;
|
import org.hibernate.query.criteria.HibernateCriteriaBuilder;
|
||||||
import org.hibernate.query.spi.QueryImplementor;
|
import org.hibernate.query.spi.QueryImplementor;
|
||||||
|
import org.hibernate.query.spi.QueryProducerImplementor;
|
||||||
import org.hibernate.query.sql.spi.NativeQueryImplementor;
|
import org.hibernate.query.sql.spi.NativeQueryImplementor;
|
||||||
import org.hibernate.resource.jdbc.spi.JdbcSessionContext;
|
import org.hibernate.resource.jdbc.spi.JdbcSessionContext;
|
||||||
import org.hibernate.resource.transaction.spi.TransactionCoordinator;
|
import org.hibernate.resource.transaction.spi.TransactionCoordinator;
|
||||||
|
@ -134,7 +133,7 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeCollection(PersistentCollection collection, boolean writing) throws HibernateException {
|
public void initializeCollection(PersistentCollection<?> collection, boolean writing) throws HibernateException {
|
||||||
delegate.initializeCollection( collection, writing );
|
delegate.initializeCollection( collection, writing );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,29 +447,8 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
|
||||||
return delegate.getEntityGraphs( entityClass );
|
return delegate.getEntityGraphs( entityClass );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private QueryProducerImplementor queryDelegate() {
|
||||||
public QueryImplementor getNamedQuery(String name) {
|
return delegate;
|
||||||
return delegate.getNamedQuery( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NativeQueryImplementor getNamedNativeQuery(String name) {
|
|
||||||
return delegate.getNamedNativeQuery( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NativeQueryImplementor getNamedNativeQuery(String name, String resultSetMapping) {
|
|
||||||
return delegate.getNamedNativeQuery( name, resultSetMapping );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public QueryImplementor createQuery(String queryString) {
|
|
||||||
return delegate.createQuery( queryString );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T> QueryImplementor<T> createQuery(String queryString, Class<T> resultType) {
|
|
||||||
return delegate.createQuery( queryString, resultType );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -478,39 +456,64 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
|
||||||
return delegate.createQuery( criteriaQuery );
|
return delegate.createQuery( criteriaQuery );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @SuppressWarnings("rawtypes")
|
||||||
public QueryImplementor createQuery(CriteriaUpdate updateQuery) {
|
public QueryImplementor createQuery(CriteriaUpdate updateQuery) {
|
||||||
return delegate.createQuery( updateQuery );
|
return delegate.createQuery( updateQuery );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @SuppressWarnings("rawtypes")
|
||||||
public QueryImplementor createQuery(CriteriaDelete deleteQuery) {
|
public QueryImplementor createQuery(CriteriaDelete deleteQuery) {
|
||||||
return delegate.createQuery( deleteQuery );
|
return delegate.createQuery( deleteQuery );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
public QueryImplementor getNamedQuery(String name) {
|
||||||
|
return queryDelegate().getNamedQuery( name );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
public NativeQueryImplementor getNamedNativeQuery(String name) {
|
||||||
|
return queryDelegate().getNamedNativeQuery( name );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
public NativeQueryImplementor getNamedNativeQuery(String name, String resultSetMapping) {
|
||||||
|
return queryDelegate().getNamedNativeQuery( name, resultSetMapping );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
public QueryImplementor createQuery(String queryString) {
|
||||||
|
return queryDelegate().createQuery( queryString );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public <T> QueryImplementor<T> createQuery(String queryString, Class<T> resultType) {
|
||||||
|
return queryDelegate().createQuery( queryString, resultType );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public QueryImplementor createNamedQuery(String name) {
|
public QueryImplementor createNamedQuery(String name) {
|
||||||
return delegate.createNamedQuery( name );
|
return queryDelegate().createNamedQuery( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> QueryImplementor<T> createNamedQuery(String name, Class<T> resultClass) {
|
public <T> QueryImplementor<T> createNamedQuery(String name, Class<T> resultClass) {
|
||||||
return delegate.createNamedQuery( name, resultClass );
|
return queryDelegate().createNamedQuery( name, resultClass );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public NativeQueryImplementor createNativeQuery(String sqlString) {
|
public NativeQueryImplementor createNativeQuery(String sqlString) {
|
||||||
return delegate.createNativeQuery( sqlString );
|
return queryDelegate().createNativeQuery( sqlString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public NativeQueryImplementor createNativeQuery(String sqlString, Class resultClass) {
|
public NativeQueryImplementor createNativeQuery(String sqlString, Class resultClass) {
|
||||||
return delegate.createNativeQuery( sqlString, resultClass );
|
return queryDelegate().createNativeQuery( sqlString, resultClass );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public NativeQueryImplementor createNativeQuery(String sqlString, String resultSetMappingName) {
|
public NativeQueryImplementor createNativeQuery(String sqlString, String resultSetMappingName) {
|
||||||
return delegate.createNativeQuery( sqlString, resultSetMappingName );
|
return queryDelegate().createNativeQuery( sqlString, resultSetMappingName );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -578,7 +581,7 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProcedureCall createStoredProcedureCall(String procedureName, Class... resultClasses) {
|
public ProcedureCall createStoredProcedureCall(String procedureName, Class<?>... resultClasses) {
|
||||||
return delegate.createStoredProcedureCall( procedureName, resultClasses );
|
return delegate.createStoredProcedureCall( procedureName, resultClasses );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -733,12 +736,12 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object merge(Object object) {
|
public <T> T merge(T object) {
|
||||||
return delegate.merge( object );
|
return delegate.merge( object );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object merge(String entityName, Object object) {
|
public <T> T merge(String entityName, T object) {
|
||||||
return delegate.merge( entityName, object );
|
return delegate.merge( entityName, object );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@ import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
|
||||||
* {@link org.hibernate.type.Type}, {@link EntityPersister}
|
* {@link org.hibernate.type.Type}, {@link EntityPersister}
|
||||||
* and {@link org.hibernate.persister.collection.CollectionPersister} implementations.
|
* and {@link org.hibernate.persister.collection.CollectionPersister} implementations.
|
||||||
*
|
*
|
||||||
* A Session, through this interface and SharedSessionContractImplementor, implements:<ul>
|
* A Session, through this interface and SharedSessionContractImplementor, implements:
|
||||||
|
* <ul>
|
||||||
* <li>
|
* <li>
|
||||||
* {@link org.hibernate.resource.jdbc.spi.JdbcSessionOwner} to drive the behavior of the
|
* {@link org.hibernate.resource.jdbc.spi.JdbcSessionOwner} to drive the behavior of the
|
||||||
* {@link org.hibernate.resource.jdbc.spi.JdbcSessionContext} delegate
|
* {@link org.hibernate.resource.jdbc.spi.JdbcSessionContext} delegate
|
||||||
|
@ -82,46 +83,6 @@ public interface SessionImplementor extends Session, SharedSessionContractImplem
|
||||||
|
|
||||||
void forceFlush(EntityEntry e) throws HibernateException;
|
void forceFlush(EntityEntry e) throws HibernateException;
|
||||||
|
|
||||||
@Override
|
|
||||||
QueryImplementor createQuery(String queryString);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
<T> QueryImplementor<T> createQuery(String queryString, Class<T> resultType);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
<T> QueryImplementor<T> createNamedQuery(String name, Class<T> resultType);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
QueryImplementor createNamedQuery(String name);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
NativeQueryImplementor createNativeQuery(String sqlString);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
NativeQueryImplementor createNativeQuery(String sqlString, Class resultClass);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
NativeQueryImplementor createNativeQuery(String sqlString, String resultSetMappingName);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
NativeQueryImplementor getNamedNativeQuery(String name);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
NativeQueryImplementor getNamedNativeQuery(String name, String resultSetMapping);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
QueryImplementor getNamedQuery(String queryName);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
<T> QueryImplementor<T> createQuery(CriteriaQuery<T> criteriaQuery);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
QueryImplementor createQuery(CriteriaUpdate updateQuery);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
QueryImplementor createQuery(CriteriaDelete deleteQuery);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated OperationalContext should cover this overload I believe; Gail?
|
* @deprecated OperationalContext should cover this overload I believe; Gail?
|
||||||
*/
|
*/
|
||||||
|
@ -157,4 +118,39 @@ public interface SessionImplementor extends Session, SharedSessionContractImplem
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void removeOrphanBeforeUpdates(String entityName, Object child);
|
void removeOrphanBeforeUpdates(String entityName, Object child);
|
||||||
|
|
||||||
|
|
||||||
|
// The following declarations just override the JPA return type with our
|
||||||
|
// Hibernate QueryImplementor type, as required by the declaration in
|
||||||
|
// QueryProducerImplementor
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
QueryImplementor getNamedQuery(String queryString);
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
QueryImplementor createQuery(String queryString);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
<R> QueryImplementor<R> createQuery(String queryString, Class<R> resultType);
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
QueryImplementor createNamedQuery(String queryString);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
<R> QueryImplementor<R> createNamedQuery(String name, Class<R> resultType);
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
NativeQueryImplementor createNativeQuery(String queryString);
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
NativeQueryImplementor createNativeQuery(String queryString, String resultSetMappingName);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
<R> QueryImplementor<R> createQuery(CriteriaQuery<R> criteriaQuery);
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
QueryImplementor createQuery(CriteriaUpdate updateQuery);
|
||||||
|
|
||||||
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
QueryImplementor createQuery(CriteriaDelete deleteQuery);
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,7 +259,7 @@ public interface SharedSessionContractImplementor
|
||||||
/**
|
/**
|
||||||
* Initialize the collection (if not already initialized)
|
* Initialize the collection (if not already initialized)
|
||||||
*/
|
*/
|
||||||
void initializeCollection(PersistentCollection collection, boolean writing)
|
void initializeCollection(PersistentCollection<?> collection, boolean writing)
|
||||||
throws HibernateException;
|
throws HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -301,7 +301,6 @@ public interface SharedSessionContractImplementor
|
||||||
/**
|
/**
|
||||||
* Return the identifier of the persistent object, or null if
|
* Return the identifier of the persistent object, or null if
|
||||||
* not associated with the session
|
* not associated with the session
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
Object getContextEntityIdentifier(Object object);
|
Object getContextEntityIdentifier(Object object);
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,6 @@ import org.hibernate.query.sql.internal.NativeQueryImpl;
|
||||||
import org.hibernate.query.sql.spi.NamedNativeQueryMemento;
|
import org.hibernate.query.sql.spi.NamedNativeQueryMemento;
|
||||||
import org.hibernate.query.sql.spi.NativeQueryImplementor;
|
import org.hibernate.query.sql.spi.NativeQueryImplementor;
|
||||||
import org.hibernate.query.sqm.internal.QuerySqmImpl;
|
import org.hibernate.query.sqm.internal.QuerySqmImpl;
|
||||||
import org.hibernate.query.sqm.tree.SqmStatement;
|
|
||||||
import org.hibernate.query.sqm.tree.delete.SqmDeleteStatement;
|
import org.hibernate.query.sqm.tree.delete.SqmDeleteStatement;
|
||||||
import org.hibernate.query.sqm.tree.select.SqmQueryGroup;
|
import org.hibernate.query.sqm.tree.select.SqmQueryGroup;
|
||||||
import org.hibernate.query.sqm.tree.select.SqmQuerySpec;
|
import org.hibernate.query.sqm.tree.select.SqmQuerySpec;
|
||||||
|
@ -216,7 +215,6 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
* Override the implementation provided on SharedSessionContractImplementor
|
* Override the implementation provided on SharedSessionContractImplementor
|
||||||
* which is not very efficient: this method is hot in Hibernate Reactive, and could
|
* which is not very efficient: this method is hot in Hibernate Reactive, and could
|
||||||
* be hot in some ORM contexts as well.
|
* be hot in some ORM contexts as well.
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Integer getConfiguredJdbcBatchSize() {
|
public Integer getConfiguredJdbcBatchSize() {
|
||||||
|
@ -255,7 +253,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
if ( statementInspector == null ) {
|
if ( statementInspector == null ) {
|
||||||
// If there is no StatementInspector specified, map to the call
|
// If there is no StatementInspector specified, map to the call
|
||||||
// to the (deprecated) Interceptor#onPrepareStatement method
|
// to the (deprecated) Interceptor#onPrepareStatement method
|
||||||
return (StatementInspector) interceptor::onPrepareStatement;
|
return interceptor::onPrepareStatement;
|
||||||
}
|
}
|
||||||
return statementInspector;
|
return statementInspector;
|
||||||
}
|
}
|
||||||
|
@ -635,13 +633,12 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// dynamic HQL handling
|
// dynamic HQL handling
|
||||||
|
|
||||||
@Override
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public QueryImplementor createQuery(String queryString) {
|
public QueryImplementor createQuery(String queryString) {
|
||||||
return createQuery( queryString, null );
|
return createQuery( queryString, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public <T> QueryImplementor<T> createQuery(String queryString, Class<T> resultClass) {
|
public <T> QueryImplementor<T> createQuery(String queryString, Class<T> resultClass) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
pulseTransactionCoordinator();
|
pulseTransactionCoordinator();
|
||||||
|
@ -676,18 +673,14 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// dynamic native (SQL) query handling
|
// dynamic native (SQL) query handling
|
||||||
|
|
||||||
@Override
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public NativeQueryImplementor createNativeQuery(String sqlString) {
|
public NativeQueryImplementor createNativeQuery(String sqlString) {
|
||||||
return getNativeQueryImplementor( sqlString );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected NativeQueryImplementor getNativeQueryImplementor(String queryString) {
|
|
||||||
checkOpen();
|
checkOpen();
|
||||||
pulseTransactionCoordinator();
|
pulseTransactionCoordinator();
|
||||||
delayedAfterCompletion();
|
delayedAfterCompletion();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
NativeQueryImpl query = new NativeQueryImpl( queryString, this );
|
NativeQueryImpl query = new NativeQueryImpl<>(sqlString, this);
|
||||||
if ( StringHelper.isEmpty( query.getComment() ) ) {
|
if ( StringHelper.isEmpty( query.getComment() ) ) {
|
||||||
query.setComment( "dynamic native SQL query" );
|
query.setComment( "dynamic native SQL query" );
|
||||||
}
|
}
|
||||||
|
@ -699,8 +692,9 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
@SuppressWarnings("unchecked")
|
//note: we're doing something a bit funny here to work around
|
||||||
|
// the classing signatures declared by the supertypes
|
||||||
public NativeQueryImplementor createNativeQuery(String sqlString, Class resultClass) {
|
public NativeQueryImplementor createNativeQuery(String sqlString, Class resultClass) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
pulseTransactionCoordinator();
|
pulseTransactionCoordinator();
|
||||||
|
@ -721,13 +715,13 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public NativeQueryImplementor createNativeQuery(String sqlString, String resultSetMappingName) {
|
public NativeQueryImplementor createNativeQuery(String sqlString, String resultSetMappingName) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
pulseTransactionCoordinator();
|
pulseTransactionCoordinator();
|
||||||
delayedAfterCompletion();
|
delayedAfterCompletion();
|
||||||
|
|
||||||
final NativeQueryImplementor query;
|
final NativeQueryImplementor<Object> query;
|
||||||
try {
|
try {
|
||||||
if ( StringHelper.isNotEmpty( resultSetMappingName ) ) {
|
if ( StringHelper.isNotEmpty( resultSetMappingName ) ) {
|
||||||
final NamedResultSetMappingMemento resultSetMappingMemento = getFactory().getQueryEngine()
|
final NamedResultSetMappingMemento resultSetMappingMemento = getFactory().getQueryEngine()
|
||||||
|
@ -738,10 +732,10 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
throw new HibernateException( "Could not resolve specified result-set mapping name : " + resultSetMappingName );
|
throw new HibernateException( "Could not resolve specified result-set mapping name : " + resultSetMappingName );
|
||||||
}
|
}
|
||||||
|
|
||||||
query = new NativeQueryImpl( sqlString, resultSetMappingMemento, this );
|
query = new NativeQueryImpl<>( sqlString, resultSetMappingMemento, this );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
query = new NativeQueryImpl( sqlString, this );
|
query = new NativeQueryImpl<>( sqlString, this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (RuntimeException he) {
|
catch (RuntimeException he) {
|
||||||
|
@ -755,12 +749,12 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// named query handling
|
// named query handling
|
||||||
|
|
||||||
@Override
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public QueryImplementor getNamedQuery(String queryName) {
|
public QueryImplementor getNamedQuery(String queryName) {
|
||||||
return buildNamedQuery( queryName, null );
|
return buildNamedQuery( queryName, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public QueryImplementor createNamedQuery(String name) {
|
public QueryImplementor createNamedQuery(String name) {
|
||||||
return buildNamedQuery( name, null );
|
return buildNamedQuery( name, null );
|
||||||
}
|
}
|
||||||
|
@ -847,10 +841,10 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void applyQuerySettingsAndHints(Query query) {
|
protected void applyQuerySettingsAndHints(Query<?> query) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public NativeQueryImplementor getNamedNativeQuery(String queryName) {
|
public NativeQueryImplementor getNamedNativeQuery(String queryName) {
|
||||||
final NamedNativeQueryMemento namedNativeDescriptor = getFactory().getQueryEngine()
|
final NamedNativeQueryMemento namedNativeDescriptor = getFactory().getQueryEngine()
|
||||||
.getNamedObjectRepository()
|
.getNamedObjectRepository()
|
||||||
|
@ -863,7 +857,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
throw getExceptionConverter().convert( new IllegalArgumentException( "No query defined for that name [" + queryName + "]" ) );
|
throw getExceptionConverter().convert( new IllegalArgumentException( "No query defined for that name [" + queryName + "]" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public NativeQueryImplementor getNamedNativeQuery(String queryName, String resultSetMapping) {
|
public NativeQueryImplementor getNamedNativeQuery(String queryName, String resultSetMapping) {
|
||||||
final NamedNativeQueryMemento namedNativeDescriptor = getFactory().getQueryEngine()
|
final NamedNativeQueryMemento namedNativeDescriptor = getFactory().getQueryEngine()
|
||||||
.getNamedObjectRepository()
|
.getNamedObjectRepository()
|
||||||
|
@ -905,16 +899,16 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||||
public ProcedureCall createStoredProcedureCall(String procedureName) {
|
public ProcedureCall createStoredProcedureCall(String procedureName) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
final ProcedureCall procedureCall = new ProcedureCallImpl( this, procedureName );
|
final ProcedureCall procedureCall = new ProcedureCallImpl<>( this, procedureName );
|
||||||
// call.setComment( "Dynamic stored procedure call" );
|
// call.setComment( "Dynamic stored procedure call" );
|
||||||
return procedureCall;
|
return procedureCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||||
public ProcedureCall createStoredProcedureCall(String procedureName, Class... resultClasses) {
|
public ProcedureCall createStoredProcedureCall(String procedureName, Class<?>... resultClasses) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
final ProcedureCall procedureCall = new ProcedureCallImpl( this, procedureName, resultClasses );
|
final ProcedureCall procedureCall = new ProcedureCallImpl<>( this, procedureName, resultClasses );
|
||||||
// call.setComment( "Dynamic stored procedure call" );
|
// call.setComment( "Dynamic stored procedure call" );
|
||||||
return procedureCall;
|
return procedureCall;
|
||||||
}
|
}
|
||||||
|
@ -923,7 +917,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||||
public ProcedureCall createStoredProcedureCall(String procedureName, String... resultSetMappings) {
|
public ProcedureCall createStoredProcedureCall(String procedureName, String... resultSetMappings) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
final ProcedureCall procedureCall = new ProcedureCallImpl( this, procedureName, resultSetMappings );
|
final ProcedureCall procedureCall = new ProcedureCallImpl<>( this, procedureName, resultSetMappings );
|
||||||
// call.setComment( "Dynamic stored procedure call" );
|
// call.setComment( "Dynamic stored procedure call" );
|
||||||
return procedureCall;
|
return procedureCall;
|
||||||
}
|
}
|
||||||
|
@ -932,16 +926,16 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||||
public ProcedureCall createStoredProcedureQuery(String procedureName) {
|
public ProcedureCall createStoredProcedureQuery(String procedureName) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
final ProcedureCall procedureCall = new ProcedureCallImpl( this, procedureName );
|
final ProcedureCall procedureCall = new ProcedureCallImpl<>( this, procedureName );
|
||||||
// call.setComment( "Dynamic stored procedure call" );
|
// call.setComment( "Dynamic stored procedure call" );
|
||||||
return procedureCall;
|
return procedureCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||||
public ProcedureCall createStoredProcedureQuery(String procedureName, Class... resultClasses) {
|
public ProcedureCall createStoredProcedureQuery(String procedureName, Class<?>... resultClasses) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
final ProcedureCall procedureCall = new ProcedureCallImpl( this, procedureName, resultClasses );
|
final ProcedureCall procedureCall = new ProcedureCallImpl<>( this, procedureName, resultClasses );
|
||||||
// call.setComment( "Dynamic stored procedure call" );
|
// call.setComment( "Dynamic stored procedure call" );
|
||||||
return procedureCall;
|
return procedureCall;
|
||||||
}
|
}
|
||||||
|
@ -950,7 +944,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||||
public ProcedureCall createStoredProcedureQuery(String procedureName, String... resultSetMappings) {
|
public ProcedureCall createStoredProcedureQuery(String procedureName, String... resultSetMappings) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
final ProcedureCall procedureCall = new ProcedureCallImpl( this, procedureName, resultSetMappings );
|
final ProcedureCall procedureCall = new ProcedureCallImpl<>( this, procedureName, resultSetMappings );
|
||||||
// call.setComment( "Dynamic stored procedure call" );
|
// call.setComment( "Dynamic stored procedure call" );
|
||||||
return procedureCall;
|
return procedureCall;
|
||||||
}
|
}
|
||||||
|
@ -1002,7 +996,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public QueryImplementor createQuery(CriteriaUpdate criteriaUpdate) {
|
public QueryImplementor createQuery(CriteriaUpdate criteriaUpdate) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
try {
|
try {
|
||||||
|
@ -1017,7 +1011,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public QueryImplementor createQuery(CriteriaDelete criteriaDelete) {
|
public QueryImplementor createQuery(CriteriaDelete criteriaDelete) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -139,7 +139,6 @@ import jakarta.persistence.EntityNotFoundException;
|
||||||
import jakarta.persistence.FlushModeType;
|
import jakarta.persistence.FlushModeType;
|
||||||
import jakarta.persistence.LockModeType;
|
import jakarta.persistence.LockModeType;
|
||||||
import jakarta.persistence.PersistenceException;
|
import jakarta.persistence.PersistenceException;
|
||||||
import jakarta.persistence.StoredProcedureQuery;
|
|
||||||
import jakarta.persistence.TransactionRequiredException;
|
import jakarta.persistence.TransactionRequiredException;
|
||||||
|
|
||||||
import static org.hibernate.cfg.AvailableSettings.JAKARTA_LOCK_SCOPE;
|
import static org.hibernate.cfg.AvailableSettings.JAKARTA_LOCK_SCOPE;
|
||||||
|
@ -152,7 +151,7 @@ import static org.hibernate.cfg.AvailableSettings.JPA_SHARED_CACHE_RETRIEVE_MODE
|
||||||
import static org.hibernate.cfg.AvailableSettings.JPA_SHARED_CACHE_STORE_MODE;
|
import static org.hibernate.cfg.AvailableSettings.JPA_SHARED_CACHE_STORE_MODE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Concrete implementation of a Session.
|
* Concrete implementation of a the {@link Session} API.
|
||||||
* <p/>
|
* <p/>
|
||||||
* Exposes two interfaces:<ul>
|
* Exposes two interfaces:<ul>
|
||||||
* <li>{@link Session} to the application</li>
|
* <li>{@link Session} to the application</li>
|
||||||
|
@ -283,7 +282,7 @@ public class SessionImpl
|
||||||
return this.lockOptions;
|
return this.lockOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void applyQuerySettingsAndHints(Query query) {
|
protected void applyQuerySettingsAndHints(Query<?> query) {
|
||||||
final LockOptions lockOptionsForRead = getLockOptionsForRead();
|
final LockOptions lockOptionsForRead = getLockOptionsForRead();
|
||||||
if ( lockOptionsForRead.getLockMode() != LockMode.NONE ) {
|
if ( lockOptionsForRead.getLockMode() != LockMode.NONE ) {
|
||||||
query.setLockMode( getLockMode( lockOptionsForRead.getLockMode() ) );
|
query.setLockMode( getLockMode( lockOptionsForRead.getLockMode() ) );
|
||||||
|
@ -1645,7 +1644,7 @@ public class SessionImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProcedureCall createStoredProcedureCall(String procedureName, Class... resultClasses) {
|
public ProcedureCall createStoredProcedureCall(String procedureName, Class<?>... resultClasses) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
// checkTransactionSynchStatus();
|
// checkTransactionSynchStatus();
|
||||||
return super.createStoredProcedureCall( procedureName, resultClasses );
|
return super.createStoredProcedureCall( procedureName, resultClasses );
|
||||||
|
@ -1658,7 +1657,7 @@ public class SessionImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeCollection(PersistentCollection collection, boolean writing) {
|
public void initializeCollection(PersistentCollection<?> collection, boolean writing) {
|
||||||
checkOpenOrWaitingForAutoClose();
|
checkOpenOrWaitingForAutoClose();
|
||||||
pulseTransactionCoordinator();
|
pulseTransactionCoordinator();
|
||||||
InitializeCollectionEvent event = new InitializeCollectionEvent( collection, this );
|
InitializeCollectionEvent event = new InitializeCollectionEvent( collection, this );
|
||||||
|
|
|
@ -247,7 +247,7 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeCollection(
|
public void initializeCollection(
|
||||||
PersistentCollection collection,
|
PersistentCollection<?> collection,
|
||||||
boolean writing) throws HibernateException {
|
boolean writing) throws HibernateException {
|
||||||
throw new SessionException( "collections cannot be fetched by a stateless session" );
|
throw new SessionException( "collections cannot be fetched by a stateless session" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -729,5 +729,5 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
|
||||||
NativeQuery<T> setProperties(Object bean);
|
NativeQuery<T> setProperties(Object bean);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
NativeQuery<T> setProperties(Map bean);
|
NativeQuery<T> setProperties(Map<?,?> bean);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,10 +47,9 @@ import org.hibernate.type.BasicTypeReference;
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*
|
*
|
||||||
* @param <R> The query result type (for typed queries)
|
* @param <R> The query result type, for typed queries, or {@code Object} for untyped queries
|
||||||
*/
|
*/
|
||||||
@Incubating
|
@Incubating
|
||||||
@SuppressWarnings("UnusedDeclaration")
|
|
||||||
public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
|
public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
|
||||||
/**
|
/**
|
||||||
* Get the QueryProducer this Query originates from. Generally speaking,
|
* Get the QueryProducer this Query originates from. Generally speaking,
|
||||||
|
@ -86,7 +85,7 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
|
||||||
* @apiNote This method calls {@link #applyGraph(RootGraph, GraphSemantic)} using
|
* @apiNote This method calls {@link #applyGraph(RootGraph, GraphSemantic)} using
|
||||||
* {@link GraphSemantic#FETCH} as the semantic
|
* {@link GraphSemantic#FETCH} as the semantic
|
||||||
*/
|
*/
|
||||||
default Query<R> applyFetchGraph(RootGraph graph) {
|
default Query<R> applyFetchGraph(RootGraph<?> graph) {
|
||||||
return applyGraph( graph, GraphSemantic.FETCH );
|
return applyGraph( graph, GraphSemantic.FETCH );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +95,8 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
|
||||||
* @apiNote This method calls {@link #applyGraph(RootGraph, GraphSemantic)} using
|
* @apiNote This method calls {@link #applyGraph(RootGraph, GraphSemantic)} using
|
||||||
* {@link GraphSemantic#LOAD} as the semantic
|
* {@link GraphSemantic#LOAD} as the semantic
|
||||||
*/
|
*/
|
||||||
default Query<R> applyLoadGraph(RootGraph graph) {
|
@SuppressWarnings("UnusedDeclaration")
|
||||||
|
default Query<R> applyLoadGraph(RootGraph<?> graph) {
|
||||||
return applyGraph( graph, GraphSemantic.LOAD );
|
return applyGraph( graph, GraphSemantic.LOAD );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -640,40 +640,6 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
|
||||||
*/
|
*/
|
||||||
<P> Query<R> setParameterList(int position, Collection<? extends P> values, AllowableParameterType<P> type);
|
<P> Query<R> setParameterList(int position, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Bind multiple values to a named query parameter. This is useful for binding
|
|
||||||
// * a list of values to an expression such as <tt>foo.bar in (:value_list)</tt>.
|
|
||||||
// *
|
|
||||||
// * @param name the name of the parameter
|
|
||||||
// * @param values a collection of values to list
|
|
||||||
// * @param type the Hibernate type of the values
|
|
||||||
// *
|
|
||||||
// * @return {@code this}, for method chaining
|
|
||||||
// *
|
|
||||||
// * @deprecated Use {@link #setParameterList(String, Object[], AllowableParameterType)}
|
|
||||||
// */
|
|
||||||
// @Deprecated
|
|
||||||
// default Query<R> setParameterList(String name, Object[] values, Type type){
|
|
||||||
// return setParameter( name, values, (AllowableParameterType)type );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Bind multiple values to a named query parameter. This is useful for binding
|
|
||||||
// * a list of values to an expression such as <tt>foo.bar in (:value_list)</tt>.
|
|
||||||
// *
|
|
||||||
// * @param position the parameter positional label
|
|
||||||
// * @param values a collection of values to list
|
|
||||||
// * @param type the Hibernate type of the values
|
|
||||||
// *
|
|
||||||
// * @return {@code this}, for method chaining
|
|
||||||
// *
|
|
||||||
// * @deprecated Use {@link #setParameterList(String, Object[], AllowableParameterType)}
|
|
||||||
// */
|
|
||||||
// @Deprecated
|
|
||||||
// default Query<R> setParameterList(int position, Object[] values, Type type){
|
|
||||||
// return setParameter( position, values, (AllowableParameterType)type );
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind multiple values to a named query parameter. This is useful for binding
|
* Bind multiple values to a named query parameter. This is useful for binding
|
||||||
* a list of values to an expression such as <tt>foo.bar in (:value_list)</tt>.
|
* a list of values to an expression such as <tt>foo.bar in (:value_list)</tt>.
|
||||||
|
@ -744,62 +710,7 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
|
||||||
*
|
*
|
||||||
* @return {@code this}, for method chaining
|
* @return {@code this}, for method chaining
|
||||||
*/
|
*/
|
||||||
Query<R> setProperties(Map bean);
|
Query<R> setProperties(Map<?,?> bean);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
// deprecations
|
|
||||||
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Bind a named query parameter using the supplied Type
|
|
||||||
// *
|
|
||||||
// * @param name the name of the parameter
|
|
||||||
// * @param val the possibly-null parameter value
|
|
||||||
// * @param type the Hibernate type
|
|
||||||
// *
|
|
||||||
// * @return {@code this}, for method chaining
|
|
||||||
// *
|
|
||||||
// * @deprecated Use {@link #setParameter(String, Object, AllowableParameterType)}
|
|
||||||
// */
|
|
||||||
// @Deprecated
|
|
||||||
// default Query<R> setParameter(String name, Object val, Type type){
|
|
||||||
// return setParameter( name, val, (AllowableParameterType) type );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Bind a value to a JDBC-style query parameter.
|
|
||||||
// *
|
|
||||||
// * @param position the position of the parameter in the query
|
|
||||||
// * string, numbered from <tt>0</tt>.
|
|
||||||
// * @param val the possibly-null parameter value
|
|
||||||
// * @param type the Hibernate type
|
|
||||||
// *
|
|
||||||
// * @return {@code this}, for method chaining
|
|
||||||
// *
|
|
||||||
// * @deprecated Use {@link #setParameter(int, Object, AllowableParameterType)}
|
|
||||||
// */
|
|
||||||
// @Deprecated
|
|
||||||
// default Query<R> setParameter(int position, Object val, Type type) {
|
|
||||||
// return setParameter( position, val, (AllowableParameterType) type );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Bind a query parameter using the supplied Type
|
|
||||||
// *
|
|
||||||
// * @param parameter The query parameter memento
|
|
||||||
// * @param val the possibly-null parameter value
|
|
||||||
// * @param type the Hibernate type
|
|
||||||
// *
|
|
||||||
// * @return {@code this}, for method chaining
|
|
||||||
// *
|
|
||||||
// * @deprecated Use {@link #setParameter(QueryParameter, Object, AllowableParameterType)}
|
|
||||||
// */
|
|
||||||
// @Deprecated
|
|
||||||
// default <P> Query<R> setParameter(QueryParameter<P> parameter, P val, Type type){
|
|
||||||
// return setParameter( parameter, val, (AllowableParameterType) type );
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated (since 5.2) Use {@link #setTupleTransformer} or {@link #setResultListTransformer}
|
* @deprecated (since 5.2) Use {@link #setTupleTransformer} or {@link #setResultListTransformer}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public interface QueryProducer {
|
||||||
* defined with the given name or if the query string is
|
* defined with the given name or if the query string is
|
||||||
* found to be invalid
|
* found to be invalid
|
||||||
*/
|
*/
|
||||||
Query getNamedQuery(String queryName);
|
<R> Query<R> getNamedQuery(String queryName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a {@link Query} instance for the given HQL/JPQL query string.
|
* Create a {@link Query} instance for the given HQL/JPQL query string.
|
||||||
|
@ -42,7 +42,7 @@ public interface QueryProducer {
|
||||||
*
|
*
|
||||||
* @see jakarta.persistence.EntityManager#createQuery(String)
|
* @see jakarta.persistence.EntityManager#createQuery(String)
|
||||||
*/
|
*/
|
||||||
Query createQuery(String queryString);
|
<R> Query<R> createQuery(String queryString);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a typed {@link Query} instance for the given HQL/JPQL query string.
|
* Create a typed {@link Query} instance for the given HQL/JPQL query string.
|
||||||
|
@ -69,7 +69,7 @@ public interface QueryProducer {
|
||||||
*
|
*
|
||||||
* @see jakarta.persistence.EntityManager#createNamedQuery(String)
|
* @see jakarta.persistence.EntityManager#createNamedQuery(String)
|
||||||
*/
|
*/
|
||||||
Query createNamedQuery(String name);
|
<R> Query<R> createNamedQuery(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The JPA-defined named, typed query creation method. This form can only
|
* The JPA-defined named, typed query creation method. This form can only
|
||||||
|
@ -98,7 +98,7 @@ public interface QueryProducer {
|
||||||
*
|
*
|
||||||
* @see jakarta.persistence.EntityManager#createNativeQuery(String)
|
* @see jakarta.persistence.EntityManager#createNativeQuery(String)
|
||||||
*/
|
*/
|
||||||
NativeQuery createNativeQuery(String sqlString);
|
<R> NativeQuery<R> createNativeQuery(String sqlString);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a NativeQuery instance for the given native (SQL) query using
|
* Create a NativeQuery instance for the given native (SQL) query using
|
||||||
|
@ -125,7 +125,7 @@ public interface QueryProducer {
|
||||||
* @see jakarta.persistence.EntityManager#createNativeQuery(String,Class)
|
* @see jakarta.persistence.EntityManager#createNativeQuery(String,Class)
|
||||||
* @see jakarta.persistence.SqlResultSetMapping
|
* @see jakarta.persistence.SqlResultSetMapping
|
||||||
*/
|
*/
|
||||||
NativeQuery createNativeQuery(String sqlString, String resultSetMappingName);
|
<R> NativeQuery<R> createNativeQuery(String sqlString, String resultSetMappingName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a NativeQuery instance for a named native SQL query
|
* Get a NativeQuery instance for a named native SQL query
|
||||||
|
@ -134,7 +134,7 @@ public interface QueryProducer {
|
||||||
*
|
*
|
||||||
* @return The NativeQuery instance for manipulation and execution
|
* @return The NativeQuery instance for manipulation and execution
|
||||||
*/
|
*/
|
||||||
NativeQuery getNamedNativeQuery(String name);
|
<R> NativeQuery<R> getNamedNativeQuery(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a NativeQuery instance for a named native SQL query
|
* Get a NativeQuery instance for a named native SQL query
|
||||||
|
@ -143,11 +143,26 @@ public interface QueryProducer {
|
||||||
*
|
*
|
||||||
* @return The NativeQuery instance for manipulation and execution
|
* @return The NativeQuery instance for manipulation and execution
|
||||||
*/
|
*/
|
||||||
NativeQuery getNamedNativeQuery(String name, String resultSetMapping);
|
<R> NativeQuery<R> getNamedNativeQuery(String name, String resultSetMapping);
|
||||||
|
|
||||||
<T> Query<T> createQuery(CriteriaQuery<T> criteriaQuery);
|
/**
|
||||||
|
* Create a Query for the given JPA {@link CriteriaQuery}
|
||||||
|
*
|
||||||
|
* @see jakarta.persistence.EntityManager#createQuery(CriteriaQuery)
|
||||||
|
*/
|
||||||
|
<R> Query<R> createQuery(CriteriaQuery<R> criteriaQuery);
|
||||||
|
|
||||||
Query createQuery(CriteriaUpdate updateQuery);
|
/**
|
||||||
|
* Create a Query for the given JPA {@link CriteriaUpdate}
|
||||||
|
*
|
||||||
|
* @see jakarta.persistence.EntityManager#createQuery(CriteriaUpdate)
|
||||||
|
*/
|
||||||
|
<R> Query<R> createQuery(CriteriaUpdate<?> updateQuery);
|
||||||
|
|
||||||
Query createQuery(CriteriaDelete deleteQuery);
|
/**
|
||||||
|
* Create a Query for the given JPA {@link CriteriaDelete}
|
||||||
|
*
|
||||||
|
* @see jakarta.persistence.EntityManager#createQuery(CriteriaDelete)
|
||||||
|
*/
|
||||||
|
<R> Query<R> createQuery(CriteriaDelete<?> deleteQuery);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1403,8 +1403,7 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings( "rawtypes" )
|
public QueryImplementor<R> setProperties(Map<?,?> map) {
|
||||||
public QueryImplementor<R> setProperties(Map map) {
|
|
||||||
for ( String paramName : getParameterMetadata().getNamedParameterNames() ) {
|
for ( String paramName : getParameterMetadata().getNamedParameterNames() ) {
|
||||||
final Object object = map.get( paramName );
|
final Object object = map.get( paramName );
|
||||||
if ( object == null ) {
|
if ( object == null ) {
|
||||||
|
@ -1413,7 +1412,7 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Class retType = object.getClass();
|
Class<?> retType = object.getClass();
|
||||||
if ( Collection.class.isAssignableFrom( retType ) ) {
|
if ( Collection.class.isAssignableFrom( retType ) ) {
|
||||||
setParameterList( paramName, (Collection) object );
|
setParameterList( paramName, (Collection) object );
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ package org.hibernate.query.spi;
|
||||||
import org.hibernate.CacheMode;
|
import org.hibernate.CacheMode;
|
||||||
import org.hibernate.FlushMode;
|
import org.hibernate.FlushMode;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.query.Query;
|
|
||||||
import org.hibernate.query.QueryProducer;
|
import org.hibernate.query.QueryProducer;
|
||||||
import org.hibernate.query.sql.spi.NativeQueryImplementor;
|
import org.hibernate.query.sql.spi.NativeQueryImplementor;
|
||||||
|
|
||||||
|
@ -27,35 +26,33 @@ public interface QueryProducerImplementor extends QueryProducer {
|
||||||
|
|
||||||
// todo : define list/scroll/iterate methods here...
|
// todo : define list/scroll/iterate methods here...
|
||||||
|
|
||||||
|
@Override
|
||||||
// overrides...
|
<R> QueryImplementor<R> getNamedQuery(String queryName);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
QueryImplementor getNamedQuery(String queryName);
|
<R> QueryImplementor<R> createQuery(String queryString);
|
||||||
|
|
||||||
@Override
|
|
||||||
QueryImplementor createQuery(String queryString);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
<R> QueryImplementor<R> createQuery(String queryString, Class<R> resultClass);
|
<R> QueryImplementor<R> createQuery(String queryString, Class<R> resultClass);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Query createNamedQuery(String name);
|
<R> QueryImplementor<R> createNamedQuery(String name);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
<R> QueryImplementor<R> createNamedQuery(String name, Class<R> resultClass);
|
<R> QueryImplementor<R> createNamedQuery(String name, Class<R> resultClass);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
NativeQueryImplementor createNativeQuery(String sqlString);
|
<R> NativeQueryImplementor<R> createNativeQuery(String sqlString);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
<R> NativeQueryImplementor<R> createNativeQuery(String sqlString, Class<R> resultClass);
|
<R> NativeQueryImplementor<R> createNativeQuery(String sqlString, Class<R> resultClass);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
NativeQueryImplementor createNativeQuery(String sqlString, String resultSetMappingName);
|
<R> NativeQueryImplementor<R> createNativeQuery(String sqlString, String resultSetMappingName);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
NativeQueryImplementor getNamedNativeQuery(String name);
|
<R> NativeQueryImplementor<R> getNamedNativeQuery(String name);
|
||||||
|
|
||||||
NativeQueryImplementor getNamedNativeQuery(String name, String resultSetMapping);
|
@Override
|
||||||
|
<R> NativeQueryImplementor<R> getNamedNativeQuery(String name, String resultSetMapping);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,13 +11,11 @@ import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -1459,7 +1457,7 @@ public class NativeQueryImpl<R>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NativeQueryImplementor<R> setProperties(Map map) {
|
public NativeQueryImplementor<R> setProperties(Map<?,?> map) {
|
||||||
super.setProperties( map );
|
super.setProperties( map );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,7 +278,7 @@ public interface NativeQueryImplementor<R> extends QueryImplementor<R>, NativeQu
|
||||||
NativeQueryImplementor<R> setProperties(Object bean);
|
NativeQueryImplementor<R> setProperties(Object bean);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
NativeQueryImplementor<R> setProperties(Map bean);
|
NativeQueryImplementor<R> setProperties(Map<?,?> bean);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
NativeQueryImplementor<R> setParameter(
|
NativeQueryImplementor<R> setParameter(
|
||||||
|
|
|
@ -123,6 +123,7 @@ public class QuerySqmImpl<R>
|
||||||
/**
|
/**
|
||||||
* Creates a Query instance from a named HQL memento
|
* Creates a Query instance from a named HQL memento
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public QuerySqmImpl(
|
public QuerySqmImpl(
|
||||||
NamedHqlQueryMemento memento,
|
NamedHqlQueryMemento memento,
|
||||||
Class<R> resultType,
|
Class<R> resultType,
|
||||||
|
@ -179,7 +180,7 @@ public class QuerySqmImpl<R>
|
||||||
if ( memento.getParameterTypes() != null ) {
|
if ( memento.getParameterTypes() != null ) {
|
||||||
for ( Map.Entry<String, String> entry : memento.getParameterTypes().entrySet() ) {
|
for ( Map.Entry<String, String> entry : memento.getParameterTypes().entrySet() ) {
|
||||||
final QueryParameterImplementor<?> parameter = parameterMetadata.getQueryParameter( entry.getKey() );
|
final QueryParameterImplementor<?> parameter = parameterMetadata.getQueryParameter( entry.getKey() );
|
||||||
final BasicType type = getSessionFactory().getTypeConfiguration()
|
final BasicType<?> type = getSessionFactory().getTypeConfiguration()
|
||||||
.getBasicTypeRegistry()
|
.getBasicTypeRegistry()
|
||||||
.getRegisteredType( entry.getValue() );
|
.getRegisteredType( entry.getValue() );
|
||||||
parameter.applyAnticipatedType( type );
|
parameter.applyAnticipatedType( type );
|
||||||
|
@ -190,6 +191,7 @@ public class QuerySqmImpl<R>
|
||||||
/**
|
/**
|
||||||
* Form used for HQL queries
|
* Form used for HQL queries
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public QuerySqmImpl(
|
public QuerySqmImpl(
|
||||||
String hqlString,
|
String hqlString,
|
||||||
HqlInterpretation hqlInterpretation,
|
HqlInterpretation hqlInterpretation,
|
||||||
|
@ -230,6 +232,7 @@ public class QuerySqmImpl<R>
|
||||||
/**
|
/**
|
||||||
* Form used for criteria queries
|
* Form used for criteria queries
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public QuerySqmImpl(
|
public QuerySqmImpl(
|
||||||
SqmStatement<R> sqmStatement,
|
SqmStatement<R> sqmStatement,
|
||||||
Class<R> resultType,
|
Class<R> resultType,
|
||||||
|
@ -326,7 +329,10 @@ public class QuerySqmImpl<R>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T> void checkQueryReturnType(SqmQuerySpec<T> querySpec, Class<T> resultClass, SessionFactoryImplementor sessionFactory) {
|
private static <T> void checkQueryReturnType(
|
||||||
|
SqmQuerySpec<T> querySpec,
|
||||||
|
Class<T> resultClass,
|
||||||
|
SessionFactoryImplementor sessionFactory) {
|
||||||
if ( resultClass == null ) {
|
if ( resultClass == null ) {
|
||||||
// nothing to check
|
// nothing to check
|
||||||
return;
|
return;
|
||||||
|
@ -352,10 +358,10 @@ public class QuerySqmImpl<R>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final SqmSelection sqmSelection = selections.get( 0 );
|
final SqmSelection<?> sqmSelection = selections.get( 0 );
|
||||||
|
|
||||||
if ( sqmSelection.getSelectableNode() instanceof SqmParameter ) {
|
if ( sqmSelection.getSelectableNode() instanceof SqmParameter ) {
|
||||||
final SqmParameter sqmParameter = (SqmParameter) sqmSelection.getSelectableNode();
|
final SqmParameter<?> sqmParameter = (SqmParameter<?>) sqmSelection.getSelectableNode();
|
||||||
|
|
||||||
// we may not yet know a selection type
|
// we may not yet know a selection type
|
||||||
if ( sqmParameter.getNodeType() == null || sqmParameter.getNodeType().getExpressableJavaTypeDescriptor() == null ) {
|
if ( sqmParameter.getNodeType() == null || sqmParameter.getNodeType().getExpressableJavaTypeDescriptor() == null ) {
|
||||||
|
@ -552,7 +558,6 @@ public class QuerySqmImpl<R>
|
||||||
return sqmStatement;
|
return sqmStatement;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public Class<R> getResultType() {
|
public Class<R> getResultType() {
|
||||||
return resultType;
|
return resultType;
|
||||||
}
|
}
|
||||||
|
@ -785,8 +790,8 @@ public class QuerySqmImpl<R>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private SelectQueryPlan<R> buildAggregatedSelectQueryPlan(SqmSelectStatement<R>[] concreteSqmStatements) {
|
private SelectQueryPlan<R> buildAggregatedSelectQueryPlan(SqmSelectStatement<R>[] concreteSqmStatements) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
final SelectQueryPlan<R>[] aggregatedQueryPlans = new SelectQueryPlan[ concreteSqmStatements.length ];
|
final SelectQueryPlan<R>[] aggregatedQueryPlans = new SelectQueryPlan[ concreteSqmStatements.length ];
|
||||||
|
|
||||||
// todo (6.0) : we want to make sure that certain thing (ResultListTransformer, etc) only get applied at the aggregator-level
|
// todo (6.0) : we want to make sure that certain thing (ResultListTransformer, etc) only get applied at the aggregator-level
|
||||||
|
@ -799,7 +804,7 @@ public class QuerySqmImpl<R>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new AggregatedSelectQueryPlanImpl( aggregatedQueryPlans );
|
return new AggregatedSelectQueryPlanImpl<>( aggregatedQueryPlans );
|
||||||
}
|
}
|
||||||
|
|
||||||
private SelectQueryPlan<R> buildConcreteSelectQueryPlan(
|
private SelectQueryPlan<R> buildConcreteSelectQueryPlan(
|
||||||
|
|
Loading…
Reference in New Issue