HHH-10664 - Prep 6.0 feature branch - merge hibernate-entitymanager into hibernate-core (stored procedure queries)
This commit is contained in:
parent
a765335563
commit
8a746b98a7
|
@ -62,7 +62,6 @@ dependencies {
|
|||
testCompile( 'org.apache.commons:commons-lang3:3.4' )
|
||||
|
||||
testCompile( project(':hibernate-core') )
|
||||
testCompile( project(':hibernate-entitymanager') )
|
||||
testCompile( project(':hibernate-ehcache') )
|
||||
testCompile( project(':hibernate-spatial') )
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.BitSet;
|
|||
import java.util.Objects;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.type.StringType;
|
||||
import org.hibernate.usertype.UserType;
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class BitSetUserType implements UserType {
|
|||
|
||||
@Override
|
||||
public Object nullSafeGet(
|
||||
ResultSet rs, String[] names, SessionImplementor session, Object owner)
|
||||
ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
|
||||
throws HibernateException, SQLException {
|
||||
String columnName = names[0];
|
||||
String columnValue = (String) rs.getObject( columnName );
|
||||
|
@ -60,7 +60,7 @@ public class BitSetUserType implements UserType {
|
|||
|
||||
@Override
|
||||
public void nullSafeSet(
|
||||
PreparedStatement st, Object value, int index, SessionImplementor session)
|
||||
PreparedStatement st, Object value, int index, SharedSessionContractImplementor session)
|
||||
throws HibernateException, SQLException {
|
||||
if ( value == null ) {
|
||||
log.debugv("Binding null to parameter {0} ",index);
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.sql.SQLException;
|
|||
import java.util.Currency;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.usertype.CompositeUserType;
|
||||
|
@ -67,7 +67,7 @@ public class MonetaryAmountUserType implements CompositeUserType {
|
|||
return ( (MonetaryAmount) x ).getAmount().hashCode();
|
||||
}
|
||||
|
||||
public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner)
|
||||
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
|
||||
throws HibernateException, SQLException {
|
||||
BigDecimal amt = StandardBasicTypes.BIG_DECIMAL.nullSafeGet( rs, names[0], session);
|
||||
Currency cur = StandardBasicTypes.CURRENCY.nullSafeGet( rs, names[1], session );
|
||||
|
@ -77,7 +77,7 @@ public class MonetaryAmountUserType implements CompositeUserType {
|
|||
|
||||
public void nullSafeSet(
|
||||
PreparedStatement st, Object value, int index,
|
||||
SessionImplementor session
|
||||
SharedSessionContractImplementor session
|
||||
) throws HibernateException, SQLException {
|
||||
MonetaryAmount ma = (MonetaryAmount) value;
|
||||
BigDecimal amt = ma == null ? null : ma.getAmount();
|
||||
|
@ -95,17 +95,17 @@ public class MonetaryAmountUserType implements CompositeUserType {
|
|||
return true;
|
||||
}
|
||||
|
||||
public Serializable disassemble(Object value, SessionImplementor session)
|
||||
public Serializable disassemble(Object value, SharedSessionContractImplementor session)
|
||||
throws HibernateException {
|
||||
return (Serializable) deepCopy( value );
|
||||
}
|
||||
|
||||
public Object assemble(Serializable cached, SessionImplementor session, Object owner)
|
||||
public Object assemble(Serializable cached, SharedSessionContractImplementor session, Object owner)
|
||||
throws HibernateException {
|
||||
return deepCopy( cached );
|
||||
}
|
||||
|
||||
public Object replace(Object original, Object target, SessionImplementor session, Object owner)
|
||||
public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner)
|
||||
throws HibernateException {
|
||||
return deepCopy( original ); //TODO: improve
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
package org.hibernate.userguide.sql;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
|
@ -17,7 +16,6 @@ import javax.persistence.PersistenceException;
|
|||
import org.hibernate.Criteria;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.dialect.H2Dialect;
|
||||
import org.hibernate.dialect.MySQL5Dialect;
|
||||
import org.hibernate.dialect.Oracle8iDialect;
|
||||
import org.hibernate.dialect.PostgreSQL82Dialect;
|
||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||
|
@ -42,6 +40,7 @@ import org.junit.Test;
|
|||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import static org.hibernate.testing.junit4.ExtraAssertions.assertTyping;
|
||||
import static org.hibernate.userguide.util.TransactionUtil.doInJPA;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
@ -485,20 +484,28 @@ public class SQLTest extends BaseEntityManagerFunctionalTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test(expected = NonUniqueDiscoveredSqlAliasException.class)
|
||||
@Test
|
||||
public void test_sql_hibernate_multi_entity_query_example() {
|
||||
doInJPA( this::entityManagerFactory, entityManager -> {
|
||||
Session session = entityManager.unwrap( Session.class );
|
||||
//tag::sql-hibernate-multi-entity-query-example[]
|
||||
List<Object> entities = session.createSQLQuery(
|
||||
"SELECT * " +
|
||||
"FROM person pr, partner pt " +
|
||||
"WHERE pr.name = pt.name" )
|
||||
.list();
|
||||
//end::sql-hibernate-multi-entity-query-example[]
|
||||
assertEquals(2, entities.size());
|
||||
});
|
||||
fail("Should throw NonUniqueDiscoveredSqlAliasException!");
|
||||
try {
|
||||
doInJPA( this::entityManagerFactory, entityManager -> {
|
||||
Session session = entityManager.unwrap( Session.class );
|
||||
//tag::sql-hibernate-multi-entity-query-example[]
|
||||
List<Object> entities = session.createSQLQuery(
|
||||
"SELECT * " +
|
||||
"FROM person pr, partner pt " +
|
||||
"WHERE pr.name = pt.name" )
|
||||
.list();
|
||||
//end::sql-hibernate-multi-entity-query-example[]
|
||||
assertEquals( 2, entities.size() );
|
||||
} );
|
||||
fail( "Should throw NonUniqueDiscoveredSqlAliasException!" );
|
||||
}
|
||||
catch (NonUniqueDiscoveredSqlAliasException e) {
|
||||
// expected
|
||||
}
|
||||
catch (PersistenceException e) {
|
||||
assertTyping( NonUniqueDiscoveredSqlAliasException.class, e.getCause() );
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -83,7 +83,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
* @see #getHibernateFlushMode()
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setHibernateFlushMode(FlushMode flushMode) {
|
||||
default org.hibernate.query.Query<R> setHibernateFlushMode(FlushMode flushMode) {
|
||||
setFlushMode( flushMode );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
* @deprecated (since 5.2) use {@link #setHibernateFlushMode} instead
|
||||
*/
|
||||
@Deprecated
|
||||
org.hibernate.query.Query setFlushMode(FlushMode flushMode);
|
||||
org.hibernate.query.Query<R> setFlushMode(FlushMode flushMode);
|
||||
|
||||
/**
|
||||
* For users of the Hibernate native APIs, we've had to rename this method
|
||||
|
@ -135,7 +135,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @see #getCacheMode()
|
||||
*/
|
||||
org.hibernate.query.Query setCacheMode(CacheMode cacheMode);
|
||||
org.hibernate.query.Query<R> setCacheMode(CacheMode cacheMode);
|
||||
|
||||
/**
|
||||
* Are the results of this query eligible for second level query caching? This is different that second level
|
||||
|
@ -160,7 +160,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @see #isCacheable
|
||||
*/
|
||||
org.hibernate.query.Query setCacheable(boolean cacheable);
|
||||
org.hibernate.query.Query<R> setCacheable(boolean cacheable);
|
||||
|
||||
/**
|
||||
* Obtain the name of the second level query cache region in which query results will be stored (if they are
|
||||
|
@ -182,7 +182,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @see #getCacheRegion()
|
||||
*/
|
||||
org.hibernate.query.Query setCacheRegion(String cacheRegion);
|
||||
org.hibernate.query.Query<R> setCacheRegion(String cacheRegion);
|
||||
|
||||
/**
|
||||
* Obtain the query timeout <b>in seconds</b>. This value is eventually passed along to the JDBC query via
|
||||
|
@ -207,7 +207,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @see #getTimeout()
|
||||
*/
|
||||
org.hibernate.query.Query setTimeout(int timeout);
|
||||
org.hibernate.query.Query<R> setTimeout(int timeout);
|
||||
|
||||
/**
|
||||
* Obtain the JDBC fetch size hint in effect for this query. This value is eventually passed along to the JDBC
|
||||
|
@ -233,7 +233,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @see #getFetchSize()
|
||||
*/
|
||||
org.hibernate.query.Query setFetchSize(int fetchSize);
|
||||
org.hibernate.query.Query<R> setFetchSize(int fetchSize);
|
||||
|
||||
/**
|
||||
* Should entities and proxies loaded by this Query be put in read-only mode? If the
|
||||
|
@ -279,7 +279,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
* are to be put in read-only mode; {@code false} indicates that entities and proxies
|
||||
* loaded by the query will be put in modifiable mode
|
||||
*/
|
||||
org.hibernate.query.Query setReadOnly(boolean readOnly);
|
||||
org.hibernate.query.Query<R> setReadOnly(boolean readOnly);
|
||||
|
||||
/**
|
||||
* Return the Hibernate types of the query results.
|
||||
|
@ -314,7 +314,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @see #getLockOptions()
|
||||
*/
|
||||
org.hibernate.query.Query setLockOptions(LockOptions lockOptions);
|
||||
org.hibernate.query.Query<R> setLockOptions(LockOptions lockOptions);
|
||||
|
||||
/**
|
||||
* Set the LockMode to use for specific alias (as defined in the query's <tt>FROM</tt> clause).
|
||||
|
@ -333,7 +333,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @see #getLockOptions()
|
||||
*/
|
||||
org.hibernate.query.Query setLockMode(String alias, LockMode lockMode);
|
||||
org.hibernate.query.Query<R> setLockMode(String alias, LockMode lockMode);
|
||||
|
||||
/**
|
||||
* Obtain the comment currently associated with this query. Provided SQL commenting is enabled
|
||||
|
@ -354,7 +354,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @see #getComment()
|
||||
*/
|
||||
org.hibernate.query.Query setComment(String comment);
|
||||
org.hibernate.query.Query<R> setComment(String comment);
|
||||
|
||||
/**
|
||||
* Add a DB query hint to the SQL. These differ from JPA's {@link javax.persistence.QueryHint}, which is specific
|
||||
|
@ -364,7 +364,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @param hint The database specific query hint to add.
|
||||
*/
|
||||
org.hibernate.query.Query addQueryHint(String hint);
|
||||
org.hibernate.query.Query<R> addQueryHint(String hint);
|
||||
|
||||
/**
|
||||
* Return the query results as an <tt>Iterator</tt>. If the query
|
||||
|
@ -457,9 +457,9 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<T> org.hibernate.query.Query setParameter(QueryParameter<T> parameter, T val);
|
||||
<T> org.hibernate.query.Query<R> setParameter(QueryParameter<T> parameter, T val);
|
||||
|
||||
<T> org.hibernate.query.Query setParameter(Parameter<T> param, T value);
|
||||
<T> org.hibernate.query.Query<R> setParameter(Parameter<T> param, T value);
|
||||
|
||||
/**
|
||||
* Bind a named query parameter using its inferred Type. If the parameter is
|
||||
|
@ -473,7 +473,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
org.hibernate.query.Query setParameter(String name, Object val);
|
||||
org.hibernate.query.Query<R> setParameter(String name, Object val);
|
||||
|
||||
/**
|
||||
* Bind a positional query parameter using its inferred Type. If the parameter is
|
||||
|
@ -488,7 +488,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
org.hibernate.query.Query setParameter(int position, Object val);
|
||||
org.hibernate.query.Query<R> setParameter(int position, Object val);
|
||||
|
||||
/**
|
||||
* Bind a query parameter using the supplied Type
|
||||
|
@ -499,7 +499,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> org.hibernate.query.Query setParameter(QueryParameter<P> parameter, P val, Type type);
|
||||
<P> org.hibernate.query.Query<R> setParameter(QueryParameter<P> parameter, P val, Type type);
|
||||
|
||||
/**
|
||||
* Bind a named query parameter using the supplied Type
|
||||
|
@ -510,7 +510,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
org.hibernate.query.Query setParameter(String name, Object val, Type type);
|
||||
org.hibernate.query.Query<R> setParameter(String name, Object val, Type type);
|
||||
|
||||
/**
|
||||
* Bind a value to a JDBC-style query parameter.
|
||||
|
@ -522,7 +522,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
org.hibernate.query.Query setParameter(int position, Object val, Type type);
|
||||
org.hibernate.query.Query<R> setParameter(int position, Object val, Type type);
|
||||
|
||||
/**
|
||||
* Bind a query parameter as some form of date/time using the indicated
|
||||
|
@ -534,7 +534,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> org.hibernate.query.Query setParameter(QueryParameter<P> parameter, P val, TemporalType temporalType);
|
||||
<P> org.hibernate.query.Query<R> setParameter(QueryParameter<P> parameter, P val, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* Bind a named query parameter as some form of date/time using
|
||||
|
@ -546,7 +546,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
org.hibernate.query.Query setParameter(String name, Object val, TemporalType temporalType);
|
||||
<P> org.hibernate.query.Query<R> setParameter(String name, P val, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* Bind a positional query parameter as some form of date/time using
|
||||
|
@ -559,7 +559,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
org.hibernate.query.Query setParameter(int position, Object val, TemporalType temporalType);
|
||||
<P> org.hibernate.query.Query<R> setParameter(int position, P val, TemporalType temporalType);
|
||||
|
||||
|
||||
|
||||
|
@ -585,7 +585,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> org.hibernate.query.Query setParameterList(QueryParameter<P> parameter, Collection<P> values);
|
||||
<P> org.hibernate.query.Query<R> setParameterList(QueryParameter<P> parameter, Collection<P> values);
|
||||
|
||||
/**
|
||||
* Bind multiple values to a named query parameter. The Hibernate type of the parameter is
|
||||
|
@ -598,7 +598,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
org.hibernate.query.Query setParameterList(String name, Collection values);
|
||||
org.hibernate.query.Query<R> setParameterList(String name, Collection values);
|
||||
|
||||
/**
|
||||
* Bind multiple values to a named query parameter. This is useful for binding
|
||||
|
@ -610,7 +610,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
org.hibernate.query.Query setParameterList(String name, Collection values, Type type);
|
||||
org.hibernate.query.Query<R> setParameterList(String name, Collection values, Type type);
|
||||
|
||||
/**
|
||||
* Bind multiple values to a named query parameter. This is useful for binding
|
||||
|
@ -622,7 +622,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
org.hibernate.query.Query setParameterList(String name, Object[] values, Type type);
|
||||
org.hibernate.query.Query<R> setParameterList(String name, Object[] values, Type type);
|
||||
|
||||
/**
|
||||
* Bind multiple values to a named query parameter. The Hibernate type of the parameter is
|
||||
|
@ -635,7 +635,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
org.hibernate.query.Query setParameterList(String name, Object[] values);
|
||||
org.hibernate.query.Query<R> setParameterList(String name, Object[] values);
|
||||
|
||||
/**
|
||||
* Bind the property values of the given bean to named parameters of the query,
|
||||
|
@ -646,7 +646,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
org.hibernate.query.Query setProperties(Object bean);
|
||||
org.hibernate.query.Query<R> setProperties(Object bean);
|
||||
|
||||
/**
|
||||
* Bind the values of the given Map for each named parameters of the query,
|
||||
|
@ -657,7 +657,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
org.hibernate.query.Query setProperties(Map bean);
|
||||
org.hibernate.query.Query<R> setProperties(Map bean);
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -713,7 +713,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setString(int position, String val) {
|
||||
default org.hibernate.query.Query<R> setString(int position, String val) {
|
||||
setParameter( position, val, StringType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -731,7 +731,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setCharacter(int position, char val) {
|
||||
default org.hibernate.query.Query<R> setCharacter(int position, char val) {
|
||||
setParameter( position, val, CharacterType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setBoolean(int position, boolean val) {
|
||||
default org.hibernate.query.Query<R> setBoolean(int position, boolean val) {
|
||||
setParameter( position, val, determineProperBooleanType( position, val, BooleanType.INSTANCE ) );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -767,7 +767,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setByte(int position, byte val) {
|
||||
default org.hibernate.query.Query<R> setByte(int position, byte val) {
|
||||
setParameter( position, val, ByteType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -785,7 +785,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setShort(int position, short val) {
|
||||
default org.hibernate.query.Query<R> setShort(int position, short val) {
|
||||
setParameter( position, val, ShortType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -803,7 +803,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setInteger(int position, int val) {
|
||||
default org.hibernate.query.Query<R> setInteger(int position, int val) {
|
||||
setParameter( position, val, IntegerType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -821,7 +821,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setLong(int position, long val) {
|
||||
default org.hibernate.query.Query<R> setLong(int position, long val) {
|
||||
setParameter( position, val, LongType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -839,7 +839,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setFloat(int position, float val) {
|
||||
default org.hibernate.query.Query<R> setFloat(int position, float val) {
|
||||
setParameter( position, val, FloatType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -857,7 +857,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setDouble(int position, double val) {
|
||||
default org.hibernate.query.Query<R> setDouble(int position, double val) {
|
||||
setParameter( position, val, DoubleType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -875,7 +875,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setBinary(int position, byte[] val) {
|
||||
default org.hibernate.query.Query<R> setBinary(int position, byte[] val) {
|
||||
setParameter( position, val, BinaryType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -893,7 +893,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setText(int position, String val) {
|
||||
default org.hibernate.query.Query<R> setText(int position, String val) {
|
||||
setParameter( position, val, TextType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -911,7 +911,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setSerializable(int position, Serializable val) {
|
||||
default org.hibernate.query.Query<R> setSerializable(int position, Serializable val) {
|
||||
setParameter( position, val );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -929,7 +929,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setLocale(int position, Locale val) {
|
||||
default org.hibernate.query.Query<R> setLocale(int position, Locale val) {
|
||||
setParameter( position, val, LocaleType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -947,7 +947,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setBigDecimal(int position, BigDecimal val) {
|
||||
default org.hibernate.query.Query<R> setBigDecimal(int position, BigDecimal val) {
|
||||
setParameter( position, val, BigDecimalType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -965,7 +965,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setBigInteger(int position, BigInteger val) {
|
||||
default org.hibernate.query.Query<R> setBigInteger(int position, BigInteger val) {
|
||||
setParameter( position, val, BigIntegerType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -983,7 +983,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setDate(int position, Date val) {
|
||||
default org.hibernate.query.Query<R> setDate(int position, Date val) {
|
||||
setParameter( position, val, DateType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1001,7 +1001,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setTime(int position, Date val) {
|
||||
default org.hibernate.query.Query<R> setTime(int position, Date val) {
|
||||
setParameter( position, val, TimeType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1019,7 +1019,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setTimestamp(int position, Date val) {
|
||||
default org.hibernate.query.Query<R> setTimestamp(int position, Date val) {
|
||||
setParameter( position, val, TimestampType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1037,7 +1037,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setCalendar(int position, Calendar val) {
|
||||
default org.hibernate.query.Query<R> setCalendar(int position, Calendar val) {
|
||||
setParameter( position, val, TimestampType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1055,7 +1055,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setCalendarDate(int position, Calendar val) {
|
||||
default org.hibernate.query.Query<R> setCalendarDate(int position, Calendar val) {
|
||||
setParameter( position, val, DateType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1073,7 +1073,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setString(String name, String val) {
|
||||
default org.hibernate.query.Query<R> setString(String name, String val) {
|
||||
setParameter( name, val, StringType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1091,7 +1091,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setCharacter(String name, char val) {
|
||||
default org.hibernate.query.Query<R> setCharacter(String name, char val) {
|
||||
setParameter( name, val, CharacterType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1109,7 +1109,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setBoolean(String name, boolean val) {
|
||||
default org.hibernate.query.Query<R> setBoolean(String name, boolean val) {
|
||||
setParameter( name, val, determineProperBooleanType( name, val, BooleanType.INSTANCE ) );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1127,7 +1127,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setByte(String name, byte val) {
|
||||
default org.hibernate.query.Query<R> setByte(String name, byte val) {
|
||||
setParameter( name, val, ByteType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1145,7 +1145,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setShort(String name, short val) {
|
||||
default org.hibernate.query.Query<R> setShort(String name, short val) {
|
||||
setParameter( name, val, ShortType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1163,7 +1163,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setInteger(String name, int val) {
|
||||
default org.hibernate.query.Query<R> setInteger(String name, int val) {
|
||||
setParameter( name, val, IntegerType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1181,7 +1181,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setLong(String name, long val) {
|
||||
default org.hibernate.query.Query<R> setLong(String name, long val) {
|
||||
setParameter( name, val, LongType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1199,7 +1199,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setFloat(String name, float val) {
|
||||
default org.hibernate.query.Query<R> setFloat(String name, float val) {
|
||||
setParameter( name, val, FloatType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1217,7 +1217,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setDouble(String name, double val) {
|
||||
default org.hibernate.query.Query<R> setDouble(String name, double val) {
|
||||
setParameter( name, val, DoubleType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1235,7 +1235,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setBinary(String name, byte[] val) {
|
||||
default org.hibernate.query.Query<R> setBinary(String name, byte[] val) {
|
||||
setParameter( name, val, BinaryType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1253,7 +1253,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setText(String name, String val) {
|
||||
default org.hibernate.query.Query<R> setText(String name, String val) {
|
||||
setParameter( name, val, TextType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1271,7 +1271,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setSerializable(String name, Serializable val) {
|
||||
default org.hibernate.query.Query<R> setSerializable(String name, Serializable val) {
|
||||
setParameter( name, val );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1288,7 +1288,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setLocale(String name, Locale val) {
|
||||
default org.hibernate.query.Query<R> setLocale(String name, Locale val) {
|
||||
setParameter( name, val, TextType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1305,7 +1305,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setBigDecimal(String name, BigDecimal val) {
|
||||
default org.hibernate.query.Query<R> setBigDecimal(String name, BigDecimal val) {
|
||||
setParameter( name, val, BigDecimalType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1322,7 +1322,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setBigInteger(String name, BigInteger val) {
|
||||
default org.hibernate.query.Query<R> setBigInteger(String name, BigInteger val) {
|
||||
setParameter( name, val, BigIntegerType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1340,7 +1340,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setDate(String name, Date val) {
|
||||
default org.hibernate.query.Query<R> setDate(String name, Date val) {
|
||||
setParameter( name, val, DateType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1358,7 +1358,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setTime(String name, Date val) {
|
||||
default org.hibernate.query.Query<R> setTime(String name, Date val) {
|
||||
setParameter( name, val, TimeType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1376,7 +1376,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setTimestamp(String name, Date value) {
|
||||
default org.hibernate.query.Query<R> setTimestamp(String name, Date value) {
|
||||
setParameter( name, value, TimestampType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1394,7 +1394,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setCalendar(String name, Calendar value) {
|
||||
default org.hibernate.query.Query<R> setCalendar(String name, Calendar value) {
|
||||
setParameter( name, value, TimestampType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1412,7 +1412,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setCalendarDate(String name, Calendar value) {
|
||||
default org.hibernate.query.Query<R> setCalendarDate(String name, Calendar value) {
|
||||
setParameter( name, value, DateType.INSTANCE );
|
||||
return (org.hibernate.query.Query) this;
|
||||
}
|
||||
|
@ -1432,7 +1432,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
org.hibernate.query.Query setEntity(int position, Object val);
|
||||
org.hibernate.query.Query<R> setEntity(int position, Object val);
|
||||
|
||||
/**
|
||||
* Bind an instance of a mapped persistent class to a named query parameter. Use
|
||||
|
@ -1448,7 +1448,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
org.hibernate.query.Query setEntity(String name, Object val);
|
||||
org.hibernate.query.Query<R> setEntity(String name, Object val);
|
||||
|
||||
/**
|
||||
* @deprecated added only to allow default method definition for deprecated methods here.
|
||||
|
@ -1478,7 +1478,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
* @todo develop a new approach to result transformers
|
||||
*/
|
||||
@Deprecated
|
||||
org.hibernate.query.Query setResultTransformer(ResultTransformer transformer);
|
||||
org.hibernate.query.Query<R> setResultTransformer(ResultTransformer transformer);
|
||||
|
||||
/**
|
||||
* @deprecated (since 5.2) use {@link javax.persistence.Tuple} if you need access to "result variables".
|
||||
|
@ -1502,7 +1502,7 @@ public interface Query<R> extends org.hibernate.BasicQueryContract, TypedQuery<R
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
default org.hibernate.query.Query setParameters(Object[] values, Type[] types) {
|
||||
default org.hibernate.query.Query<R> setParameters(Object[] values, Type[] types) {
|
||||
assert values.length == types.length;
|
||||
for ( int i = 0; i < values.length; i++ ) {
|
||||
setParameter( i, values[i], types[i] );
|
||||
|
|
|
@ -56,7 +56,7 @@ import org.hibernate.type.Type;
|
|||
* @deprecated (since 5.2) use {@link NativeQuery} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public interface SQLQuery extends Query<Object>, SynchronizeableQuery {
|
||||
public interface SQLQuery<T> extends Query<T>, SynchronizeableQuery<T> {
|
||||
/**
|
||||
* Use a predefined named result-set mapping. This might be defined by a {@code <result-set/>} element in a
|
||||
* Hibernate <tt>hbm.xml</tt> file or through a {@link javax.persistence.SqlResultSetMapping} annotation.
|
||||
|
@ -65,7 +65,7 @@ public interface SQLQuery extends Query<Object>, SynchronizeableQuery {
|
|||
*
|
||||
* @return this, for method chaining
|
||||
*/
|
||||
NativeQuery setResultSetMapping(String name);
|
||||
NativeQuery<T> setResultSetMapping(String name);
|
||||
|
||||
/**
|
||||
* Is this native-SQL query known to be callable?
|
||||
|
@ -90,7 +90,7 @@ public interface SQLQuery extends Query<Object>, SynchronizeableQuery {
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
NativeQuery addScalar(String columnAlias);
|
||||
NativeQuery<T> addScalar(String columnAlias);
|
||||
|
||||
/**
|
||||
* Declare a scalar query result.
|
||||
|
@ -102,7 +102,7 @@ public interface SQLQuery extends Query<Object>, SynchronizeableQuery {
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
NativeQuery addScalar(String columnAlias, Type type);
|
||||
NativeQuery<T> addScalar(String columnAlias, Type type);
|
||||
|
||||
/**
|
||||
* Add a new root return mapping, returning a {@link NativeQuery.RootReturn} to allow further definition.
|
||||
|
@ -138,7 +138,7 @@ public interface SQLQuery extends Query<Object>, SynchronizeableQuery {
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
NativeQuery addEntity(String entityName);
|
||||
NativeQuery<T> addEntity(String entityName);
|
||||
|
||||
/**
|
||||
* Declare a "root" entity.
|
||||
|
@ -148,7 +148,7 @@ public interface SQLQuery extends Query<Object>, SynchronizeableQuery {
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
NativeQuery addEntity(String tableAlias, String entityName);
|
||||
NativeQuery<T> addEntity(String tableAlias, String entityName);
|
||||
|
||||
/**
|
||||
* Declare a "root" entity, specifying a lock mode.
|
||||
|
@ -159,7 +159,7 @@ public interface SQLQuery extends Query<Object>, SynchronizeableQuery {
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
NativeQuery addEntity(String tableAlias, String entityName, LockMode lockMode);
|
||||
NativeQuery<T> addEntity(String tableAlias, String entityName, LockMode lockMode);
|
||||
|
||||
/**
|
||||
* Declare a "root" entity, without specifying an alias. The expectation here is that the table alias is the
|
||||
|
@ -169,7 +169,7 @@ public interface SQLQuery extends Query<Object>, SynchronizeableQuery {
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
NativeQuery addEntity(Class entityType);
|
||||
NativeQuery<T> addEntity(Class entityType);
|
||||
|
||||
/**
|
||||
* Declare a "root" entity.
|
||||
|
@ -179,7 +179,7 @@ public interface SQLQuery extends Query<Object>, SynchronizeableQuery {
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
NativeQuery addEntity(String tableAlias, Class entityType);
|
||||
NativeQuery<T> addEntity(String tableAlias, Class entityType);
|
||||
|
||||
/**
|
||||
* Declare a "root" entity, specifying a lock mode.
|
||||
|
@ -190,7 +190,7 @@ public interface SQLQuery extends Query<Object>, SynchronizeableQuery {
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
NativeQuery addEntity(String tableAlias, Class entityClass, LockMode lockMode);
|
||||
NativeQuery<T> addEntity(String tableAlias, Class entityClass, LockMode lockMode);
|
||||
|
||||
/**
|
||||
* Declare a join fetch result.
|
||||
|
@ -214,7 +214,7 @@ public interface SQLQuery extends Query<Object>, SynchronizeableQuery {
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
NativeQuery addJoin(String tableAlias, String path);
|
||||
NativeQuery<T> addJoin(String tableAlias, String path);
|
||||
|
||||
/**
|
||||
* Declare a join fetch result.
|
||||
|
@ -228,7 +228,7 @@ public interface SQLQuery extends Query<Object>, SynchronizeableQuery {
|
|||
*
|
||||
* @since 3.6
|
||||
*/
|
||||
NativeQuery addJoin(String tableAlias, String ownerTableAlias, String joinPropertyName);
|
||||
NativeQuery<T> addJoin(String tableAlias, String ownerTableAlias, String joinPropertyName);
|
||||
|
||||
/**
|
||||
* Declare a join fetch result, specifying a lock mode.
|
||||
|
@ -239,7 +239,7 @@ public interface SQLQuery extends Query<Object>, SynchronizeableQuery {
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
NativeQuery addJoin(String tableAlias, String path, LockMode lockMode);
|
||||
NativeQuery<T> addJoin(String tableAlias, String path, LockMode lockMode);
|
||||
|
||||
/**
|
||||
* Allows access to further control how properties within a root or join fetch are mapped back from the result set.
|
||||
|
@ -337,120 +337,120 @@ public interface SQLQuery extends Query<Object>, SynchronizeableQuery {
|
|||
|
||||
|
||||
@Override
|
||||
NativeQuery setHibernateFlushMode(FlushMode flushMode);
|
||||
NativeQuery<T> setHibernateFlushMode(FlushMode flushMode);
|
||||
|
||||
@Override
|
||||
NativeQuery setFlushMode(FlushModeType flushMode);
|
||||
NativeQuery<T> setFlushMode(FlushModeType flushMode);
|
||||
|
||||
@Override
|
||||
NativeQuery setCacheMode(CacheMode cacheMode);
|
||||
NativeQuery<T> setCacheMode(CacheMode cacheMode);
|
||||
|
||||
@Override
|
||||
NativeQuery setCacheable(boolean cacheable);
|
||||
NativeQuery<T> setCacheable(boolean cacheable);
|
||||
|
||||
@Override
|
||||
NativeQuery setCacheRegion(String cacheRegion);
|
||||
NativeQuery<T> setCacheRegion(String cacheRegion);
|
||||
|
||||
@Override
|
||||
NativeQuery setTimeout(int timeout);
|
||||
NativeQuery<T> setTimeout(int timeout);
|
||||
|
||||
@Override
|
||||
NativeQuery setFetchSize(int fetchSize);
|
||||
NativeQuery<T> setFetchSize(int fetchSize);
|
||||
|
||||
@Override
|
||||
NativeQuery setReadOnly(boolean readOnly);
|
||||
NativeQuery<T> setReadOnly(boolean readOnly);
|
||||
|
||||
@Override
|
||||
NativeQuery setLockOptions(LockOptions lockOptions);
|
||||
NativeQuery<T> setLockOptions(LockOptions lockOptions);
|
||||
|
||||
@Override
|
||||
NativeQuery setLockMode(String alias, LockMode lockMode);
|
||||
NativeQuery<T> setLockMode(String alias, LockMode lockMode);
|
||||
|
||||
@Override
|
||||
NativeQuery setComment(String comment);
|
||||
NativeQuery<T> setComment(String comment);
|
||||
|
||||
@Override
|
||||
NativeQuery addQueryHint(String hint);
|
||||
NativeQuery<T> addQueryHint(String hint);
|
||||
|
||||
@Override
|
||||
<T> NativeQuery setParameter(QueryParameter<T> parameter, T val);
|
||||
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val);
|
||||
|
||||
@Override
|
||||
<T> NativeQuery setParameter(Parameter<T> param, T value);
|
||||
<P> NativeQuery<T> setParameter(Parameter<P> param, P value);
|
||||
|
||||
@Override
|
||||
NativeQuery setParameter(String name, Object val);
|
||||
NativeQuery<T> setParameter(String name, Object val);
|
||||
|
||||
@Override
|
||||
NativeQuery setParameter(int position, Object val);
|
||||
NativeQuery<T> setParameter(int position, Object val);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery setParameter(QueryParameter<P> parameter, P val, Type type);
|
||||
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val, Type type);
|
||||
|
||||
@Override
|
||||
NativeQuery setParameter(String name, Object val, Type type);
|
||||
NativeQuery<T> setParameter(String name, Object val, Type type);
|
||||
|
||||
@Override
|
||||
NativeQuery setParameter(int position, Object val, Type type);
|
||||
NativeQuery<T> setParameter(int position, Object val, Type type);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery setParameter(QueryParameter<P> parameter, P val, TemporalType temporalType);
|
||||
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery setParameter(String name, Object val, TemporalType temporalType);
|
||||
<P> NativeQuery<T> setParameter(String name, P val, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery setParameter(int position, Object val, TemporalType temporalType);
|
||||
<P> NativeQuery<T> setParameter(int position, P val, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery setParameterList(QueryParameter<P> parameter, Collection<P> values);
|
||||
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, Collection<P> values);
|
||||
|
||||
@Override
|
||||
NativeQuery setParameterList(String name, Collection values);
|
||||
NativeQuery<T> setParameterList(String name, Collection values);
|
||||
|
||||
@Override
|
||||
NativeQuery setParameterList(String name, Collection values, Type type);
|
||||
NativeQuery<T> setParameterList(String name, Collection values, Type type);
|
||||
|
||||
@Override
|
||||
NativeQuery setParameterList(String name, Object[] values, Type type);
|
||||
NativeQuery<T> setParameterList(String name, Object[] values, Type type);
|
||||
|
||||
@Override
|
||||
NativeQuery setParameterList(String name, Object[] values);
|
||||
NativeQuery<T> setParameterList(String name, Object[] values);
|
||||
|
||||
@Override
|
||||
NativeQuery setProperties(Object bean);
|
||||
NativeQuery<T> setProperties(Object bean);
|
||||
|
||||
@Override
|
||||
NativeQuery setProperties(Map bean);
|
||||
NativeQuery<T> setProperties(Map bean);
|
||||
|
||||
@Override
|
||||
NativeQuery setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType);
|
||||
NativeQuery<T> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery setParameter(Parameter<Date> param, Date value, TemporalType temporalType);
|
||||
NativeQuery<T> setParameter(Parameter<Date> param, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery setParameter(String name, Calendar value, TemporalType temporalType);
|
||||
NativeQuery<T> setParameter(String name, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery setParameter(String name, Date value, TemporalType temporalType);
|
||||
NativeQuery<T> setParameter(String name, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery setParameter(int position, Calendar value, TemporalType temporalType);
|
||||
NativeQuery<T> setParameter(int position, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery setParameter(int position, Date value, TemporalType temporalType);
|
||||
NativeQuery<T> setParameter(int position, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery addSynchronizedQuerySpace(String querySpace);
|
||||
NativeQuery<T> addSynchronizedQuerySpace(String querySpace);
|
||||
|
||||
@Override
|
||||
NativeQuery addSynchronizedEntityName(String entityName) throws MappingException;
|
||||
NativeQuery<T> addSynchronizedEntityName(String entityName) throws MappingException;
|
||||
|
||||
@Override
|
||||
NativeQuery addSynchronizedEntityClass(Class entityClass) throws MappingException;
|
||||
NativeQuery<T> addSynchronizedEntityClass(Class entityClass) throws MappingException;
|
||||
|
||||
@Override
|
||||
NativeQuery setFlushMode(FlushMode flushMode);
|
||||
NativeQuery<T> setFlushMode(FlushMode flushMode);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.util.Collection;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface SynchronizeableQuery {
|
||||
public interface SynchronizeableQuery<T> {
|
||||
/**
|
||||
* Obtain the list of query spaces the query is synchronized on.
|
||||
*
|
||||
|
@ -34,7 +34,7 @@ public interface SynchronizeableQuery {
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
SynchronizeableQuery addSynchronizedQuerySpace(String querySpace);
|
||||
SynchronizeableQuery<T> addSynchronizedQuerySpace(String querySpace);
|
||||
|
||||
/**
|
||||
* Adds an entity name for (a) auto-flush checking and (b) query result cache invalidation checking. Same as
|
||||
|
@ -46,7 +46,7 @@ public interface SynchronizeableQuery {
|
|||
*
|
||||
* @throws MappingException Indicates the given name could not be resolved as an entity
|
||||
*/
|
||||
SynchronizeableQuery addSynchronizedEntityName(String entityName) throws MappingException;
|
||||
SynchronizeableQuery<T> addSynchronizedEntityName(String entityName) throws MappingException;
|
||||
|
||||
/**
|
||||
* Adds an entity for (a) auto-flush checking and (b) query result cache invalidation checking. Same as
|
||||
|
@ -58,5 +58,5 @@ public interface SynchronizeableQuery {
|
|||
*
|
||||
* @throws MappingException Indicates the given class could not be resolved as an entity
|
||||
*/
|
||||
SynchronizeableQuery addSynchronizedEntityClass(Class entityClass) throws MappingException;
|
||||
SynchronizeableQuery<T> addSynchronizedEntityClass(Class entityClass) throws MappingException;
|
||||
}
|
||||
|
|
|
@ -765,11 +765,11 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
|||
if ( resultType != null ) {
|
||||
resultClassChecking( resultType, queryDefinition );
|
||||
}
|
||||
String queryString = queryDefinition.getQueryString();
|
||||
|
||||
final NativeQueryImpl query = new NativeQueryImpl(
|
||||
queryDefinition,
|
||||
this,
|
||||
getQueryPlan( queryString, false ).getParameterMetadata()
|
||||
factory.getQueryPlanCache().getSQLParameterMetadata( queryDefinition.getQueryString() )
|
||||
);
|
||||
query.setHibernateFlushMode( queryDefinition.getFlushMode() );
|
||||
query.setComment( queryDefinition.getComment() != null ? queryDefinition.getComment() : queryDefinition.getName() );
|
||||
|
|
|
@ -107,7 +107,6 @@ import org.hibernate.procedure.ProcedureCall;
|
|||
import org.hibernate.proxy.EntityNotFoundDelegate;
|
||||
import org.hibernate.proxy.HibernateProxyHelper;
|
||||
import org.hibernate.query.criteria.internal.CriteriaBuilderImpl;
|
||||
import org.hibernate.query.procedure.internal.StoredProcedureQueryImpl;
|
||||
import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode;
|
||||
import org.hibernate.resource.jdbc.spi.StatementInspector;
|
||||
import org.hibernate.resource.transaction.backend.jta.internal.synchronization.AfterCompletionAction;
|
||||
|
@ -756,7 +755,7 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
|
|||
|
||||
// first, handle StoredProcedureQuery
|
||||
try {
|
||||
final StoredProcedureQueryImpl unwrapped = query.unwrap( StoredProcedureQueryImpl.class );
|
||||
final ProcedureCall unwrapped = query.unwrap( ProcedureCall.class );
|
||||
if ( unwrapped != null ) {
|
||||
addNamedStoredProcedureQuery( name, unwrapped );
|
||||
return;
|
||||
|
@ -799,11 +798,10 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
|
|||
);
|
||||
}
|
||||
|
||||
private void addNamedStoredProcedureQuery(String name, StoredProcedureQueryImpl query) {
|
||||
final ProcedureCall procedureCall = query.getHibernateProcedureCall();
|
||||
private void addNamedStoredProcedureQuery(String name, ProcedureCall procedureCall) {
|
||||
getNamedQueryRepository().registerNamedProcedureCallMemento(
|
||||
name,
|
||||
procedureCall.extractMemento( query.getHints() )
|
||||
procedureCall.extractMemento( procedureCall.getHints() )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -181,7 +181,6 @@ import org.hibernate.query.criteria.internal.compile.CompilableCriteria;
|
|||
import org.hibernate.query.criteria.internal.compile.CriteriaCompiler;
|
||||
import org.hibernate.query.criteria.internal.expression.CompoundSelectionImpl;
|
||||
import org.hibernate.query.internal.CollectionFilterImpl;
|
||||
import org.hibernate.query.procedure.internal.StoredProcedureQueryImpl;
|
||||
import org.hibernate.query.spi.QueryImplementor;
|
||||
import org.hibernate.resource.transaction.TransactionRequiredForJoinException;
|
||||
import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl;
|
||||
|
@ -3806,14 +3805,7 @@ public final class SessionImpl
|
|||
if ( memento == null ) {
|
||||
throw new IllegalArgumentException( "No @NamedStoredProcedureQuery was found with that name : " + name );
|
||||
}
|
||||
final StoredProcedureQueryImpl jpaImpl = new StoredProcedureQueryImpl( memento, this );
|
||||
// apply hints
|
||||
if ( memento.getHintsMap() != null ) {
|
||||
for ( Map.Entry<String,Object> hintEntry : memento.getHintsMap().entrySet() ) {
|
||||
jpaImpl.setHint( hintEntry.getKey(), hintEntry.getValue() );
|
||||
}
|
||||
}
|
||||
return jpaImpl;
|
||||
return memento.makeProcedureCall( this );
|
||||
}
|
||||
catch ( RuntimeException e ) {
|
||||
throw convert( e );
|
||||
|
@ -3822,12 +3814,8 @@ public final class SessionImpl
|
|||
|
||||
@Override
|
||||
public StoredProcedureQuery createStoredProcedureQuery(String procedureName) {
|
||||
checkOpen();
|
||||
try {
|
||||
return new StoredProcedureQueryImpl(
|
||||
createStoredProcedureCall( procedureName ),
|
||||
this
|
||||
);
|
||||
return createStoredProcedureCall( procedureName );
|
||||
}
|
||||
catch ( RuntimeException e ) {
|
||||
throw convert( e );
|
||||
|
@ -3836,12 +3824,8 @@ public final class SessionImpl
|
|||
|
||||
@Override
|
||||
public StoredProcedureQuery createStoredProcedureQuery(String procedureName, Class... resultClasses) {
|
||||
checkOpen();
|
||||
try {
|
||||
return new StoredProcedureQueryImpl(
|
||||
createStoredProcedureCall( procedureName, resultClasses ),
|
||||
this
|
||||
);
|
||||
return createStoredProcedureCall( procedureName, resultClasses );
|
||||
}
|
||||
catch ( RuntimeException e ) {
|
||||
throw convert( e );
|
||||
|
@ -3853,10 +3837,7 @@ public final class SessionImpl
|
|||
checkOpen();
|
||||
try {
|
||||
try {
|
||||
return new StoredProcedureQueryImpl(
|
||||
createStoredProcedureCall( procedureName, resultSetMappings ),
|
||||
this
|
||||
);
|
||||
return createStoredProcedureCall( procedureName, resultSetMappings );
|
||||
}
|
||||
catch (UnknownSqlResultSetMappingException unknownResultSetMapping) {
|
||||
throw new IllegalArgumentException( unknownResultSetMapping.getMessage(), unknownResultSetMapping );
|
||||
|
|
|
@ -9,6 +9,7 @@ package org.hibernate.procedure;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.persistence.ParameterMode;
|
||||
import javax.persistence.StoredProcedureQuery;
|
||||
|
||||
import org.hibernate.BasicQueryContract;
|
||||
import org.hibernate.MappingException;
|
||||
|
@ -19,22 +20,22 @@ import org.hibernate.SynchronizeableQuery;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface ProcedureCall extends BasicQueryContract, SynchronizeableQuery {
|
||||
public interface ProcedureCall extends BasicQueryContract, SynchronizeableQuery, StoredProcedureQuery {
|
||||
@Override
|
||||
public ProcedureCall addSynchronizedQuerySpace(String querySpace);
|
||||
ProcedureCall addSynchronizedQuerySpace(String querySpace);
|
||||
|
||||
@Override
|
||||
public ProcedureCall addSynchronizedEntityName(String entityName) throws MappingException;
|
||||
ProcedureCall addSynchronizedEntityName(String entityName) throws MappingException;
|
||||
|
||||
@Override
|
||||
public ProcedureCall addSynchronizedEntityClass(Class entityClass) throws MappingException;
|
||||
ProcedureCall addSynchronizedEntityClass(Class entityClass) throws MappingException;
|
||||
|
||||
/**
|
||||
* Get the name of the stored procedure to be called.
|
||||
*
|
||||
* @return The procedure name.
|
||||
*/
|
||||
public String getProcedureName();
|
||||
String getProcedureName();
|
||||
|
||||
/**
|
||||
* Basic form for registering a positional parameter.
|
||||
|
@ -46,7 +47,7 @@ public interface ProcedureCall extends BasicQueryContract, SynchronizeableQuery
|
|||
*
|
||||
* @return The parameter registration memento
|
||||
*/
|
||||
public <T> ParameterRegistration<T> registerParameter(int position, Class<T> type, ParameterMode mode);
|
||||
<T> ParameterRegistration<T> registerParameter(int position, Class<T> type, ParameterMode mode);
|
||||
|
||||
/**
|
||||
* Chained form of {@link #registerParameter(int, Class, javax.persistence.ParameterMode)}
|
||||
|
@ -57,7 +58,7 @@ public interface ProcedureCall extends BasicQueryContract, SynchronizeableQuery
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
public ProcedureCall registerParameter0(int position, Class type, ParameterMode mode);
|
||||
ProcedureCall registerParameter0(int position, Class type, ParameterMode mode);
|
||||
|
||||
/**
|
||||
* Retrieve a previously registered parameter memento by the position under which it was registered.
|
||||
|
@ -69,7 +70,7 @@ public interface ProcedureCall extends BasicQueryContract, SynchronizeableQuery
|
|||
* @throws ParameterStrategyException If the ProcedureCall is defined using named parameters
|
||||
* @throws NoSuchParameterException If no parameter with that position exists
|
||||
*/
|
||||
public ParameterRegistration getParameterRegistration(int position);
|
||||
ParameterRegistration getParameterRegistration(int position);
|
||||
|
||||
/**
|
||||
* Basic form for registering a named parameter.
|
||||
|
@ -84,7 +85,7 @@ public interface ProcedureCall extends BasicQueryContract, SynchronizeableQuery
|
|||
* @throws NamedParametersNotSupportedException When the underlying database is known to not support
|
||||
* named procedure parameters.
|
||||
*/
|
||||
public <T> ParameterRegistration<T> registerParameter(String parameterName, Class<T> type, ParameterMode mode)
|
||||
<T> ParameterRegistration<T> registerParameter(String parameterName, Class<T> type, ParameterMode mode)
|
||||
throws NamedParametersNotSupportedException;
|
||||
|
||||
/**
|
||||
|
@ -99,7 +100,7 @@ public interface ProcedureCall extends BasicQueryContract, SynchronizeableQuery
|
|||
* @throws NamedParametersNotSupportedException When the underlying database is known to not support
|
||||
* named procedure parameters.
|
||||
*/
|
||||
public ProcedureCall registerParameter0(String parameterName, Class type, ParameterMode mode)
|
||||
ProcedureCall registerParameter0(String parameterName, Class type, ParameterMode mode)
|
||||
throws NamedParametersNotSupportedException;
|
||||
|
||||
/**
|
||||
|
@ -112,14 +113,14 @@ public interface ProcedureCall extends BasicQueryContract, SynchronizeableQuery
|
|||
* @throws ParameterStrategyException If the ProcedureCall is defined using positional parameters
|
||||
* @throws NoSuchParameterException If no parameter with that name exists
|
||||
*/
|
||||
public ParameterRegistration getParameterRegistration(String name);
|
||||
ParameterRegistration getParameterRegistration(String name);
|
||||
|
||||
/**
|
||||
* Retrieve all registered parameters.
|
||||
*
|
||||
* @return The (immutable) list of all registered parameters.
|
||||
*/
|
||||
public List<ParameterRegistration> getRegisteredParameters();
|
||||
List<ParameterRegistration> getRegisteredParameters();
|
||||
|
||||
/**
|
||||
* Retrieves access to outputs of this procedure call. Can be called multiple times, returning the same
|
||||
|
@ -130,7 +131,7 @@ public interface ProcedureCall extends BasicQueryContract, SynchronizeableQuery
|
|||
*
|
||||
* @return The ProcedureOutputs representation
|
||||
*/
|
||||
public ProcedureOutputs getOutputs();
|
||||
ProcedureOutputs getOutputs();
|
||||
|
||||
/**
|
||||
* Extract the disconnected representation of this call. Used in HEM to allow redefining a named query
|
||||
|
@ -139,5 +140,12 @@ public interface ProcedureCall extends BasicQueryContract, SynchronizeableQuery
|
|||
*
|
||||
* @return The memento
|
||||
*/
|
||||
public ProcedureCallMemento extractMemento(Map<String, Object> hints);
|
||||
ProcedureCallMemento extractMemento(Map<String, Object> hints);
|
||||
|
||||
/**
|
||||
* Extract the disconnected representation of this call. Used in HEM to allow redefining a named query
|
||||
* *
|
||||
* @return The memento
|
||||
*/
|
||||
ProcedureCallMemento extractMemento();
|
||||
}
|
||||
|
|
|
@ -10,13 +10,24 @@ import java.sql.CallableStatement;
|
|||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.persistence.FlushModeType;
|
||||
import javax.persistence.LockModeType;
|
||||
import javax.persistence.NoResultException;
|
||||
import javax.persistence.NonUniqueResultException;
|
||||
import javax.persistence.Parameter;
|
||||
import javax.persistence.ParameterMode;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.TransactionRequiredException;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.engine.ResultSetMappingDefinition;
|
||||
import org.hibernate.engine.jdbc.env.spi.ExtractedDatabaseMetaData;
|
||||
|
@ -37,8 +48,15 @@ import org.hibernate.procedure.ProcedureCallMemento;
|
|||
import org.hibernate.procedure.ProcedureOutputs;
|
||||
import org.hibernate.procedure.spi.ParameterRegistrationImplementor;
|
||||
import org.hibernate.procedure.spi.ParameterStrategy;
|
||||
import org.hibernate.query.Query;
|
||||
import org.hibernate.procedure.spi.ProcedureCallImplementor;
|
||||
import org.hibernate.query.ParameterMetadata;
|
||||
import org.hibernate.query.QueryParameter;
|
||||
import org.hibernate.query.internal.AbstractProducedQuery;
|
||||
import org.hibernate.query.spi.QueryParameterBindings;
|
||||
import org.hibernate.result.NoMoreReturnsException;
|
||||
import org.hibernate.result.Output;
|
||||
import org.hibernate.result.ResultSetOutput;
|
||||
import org.hibernate.result.UpdateCountOutput;
|
||||
import org.hibernate.result.spi.ResultContext;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
|
@ -49,7 +67,9 @@ import org.jboss.logging.Logger;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class ProcedureCallImpl extends AbstractProducedQuery implements ProcedureCall, ResultContext {
|
||||
public class ProcedureCallImpl<R>
|
||||
extends AbstractProducedQuery<R>
|
||||
implements ProcedureCallImplementor<R>, ResultContext {
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(
|
||||
CoreMessageLogger.class,
|
||||
ProcedureCallImpl.class.getName()
|
||||
|
@ -235,6 +255,10 @@ public class ProcedureCallImpl extends AbstractProducedQuery implements Procedur
|
|||
parameterRegistrations.add( registration );
|
||||
}
|
||||
this.registeredParameters = parameterRegistrations;
|
||||
|
||||
for ( Map.Entry<String, Object> entry : memento.getHintsMap().entrySet() ) {
|
||||
setHint( entry.getKey(), entry.getValue() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -443,12 +467,12 @@ public class ProcedureCallImpl extends AbstractProducedQuery implements Procedur
|
|||
}
|
||||
|
||||
@Override
|
||||
public Query setEntity(int position, Object val) {
|
||||
public ProcedureCallImplementor<R> setEntity(int position, Object val) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Query setEntity(String name, Object val) {
|
||||
public ProcedureCallImplementor<R> setEntity(String name, Object val) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -477,13 +501,13 @@ public class ProcedureCallImpl extends AbstractProducedQuery implements Procedur
|
|||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImpl addSynchronizedQuerySpace(String querySpace) {
|
||||
public ProcedureCallImplementor<R> addSynchronizedQuerySpace(String querySpace) {
|
||||
synchronizedQuerySpaces().add( querySpace );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImpl addSynchronizedEntityName(String entityName) {
|
||||
public ProcedureCallImplementor<R> addSynchronizedEntityName(String entityName) {
|
||||
addSynchronizedQuerySpaces( getSession().getFactory().getMetamodel().entityPersister( entityName ) );
|
||||
return this;
|
||||
}
|
||||
|
@ -493,7 +517,7 @@ public class ProcedureCallImpl extends AbstractProducedQuery implements Procedur
|
|||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImpl addSynchronizedEntityClass(Class entityClass) {
|
||||
public ProcedureCallImplementor<R> addSynchronizedEntityClass(Class entityClass) {
|
||||
addSynchronizedQuerySpaces( getSession().getFactory().getMetamodel().entityPersister( entityClass.getName() ) );
|
||||
return this;
|
||||
}
|
||||
|
@ -539,6 +563,17 @@ public class ProcedureCallImpl extends AbstractProducedQuery implements Procedur
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallMemento extractMemento() {
|
||||
return new ProcedureCallMementoImpl(
|
||||
procedureName,
|
||||
Util.copy( queryReturns ),
|
||||
parameterStrategy,
|
||||
toParameterMementos( registeredParameters ),
|
||||
Util.copy( synchronizedQuerySpaces ),
|
||||
Util.copy( getHints() )
|
||||
);
|
||||
}
|
||||
|
||||
private static List<ProcedureCallMementoImpl.ParameterMemento> toParameterMementos(List<ParameterRegistrationImplementor<?>> registeredParameters) {
|
||||
if ( registeredParameters == null ) {
|
||||
|
@ -551,4 +586,366 @@ public class ProcedureCallImpl extends AbstractProducedQuery implements Procedur
|
|||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// JPA StoredProcedureQuery impl
|
||||
|
||||
private ProcedureOutputs procedureResult;
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> registerStoredProcedureParameter(int position, Class type, ParameterMode mode) {
|
||||
getProducer().checkOpen( true );
|
||||
getProducer().checkOpen( true );
|
||||
|
||||
try {
|
||||
registerParameter( (ParameterRegistrationImplementor) registerParameter( position, type, mode ) );
|
||||
}
|
||||
catch (HibernateException he) {
|
||||
throw getProducer().convert( he );
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
getProducer().markForRollbackOnly();
|
||||
throw e;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> registerStoredProcedureParameter(String parameterName, Class type, ParameterMode mode) {
|
||||
getProducer().checkOpen( true );
|
||||
|
||||
try {
|
||||
registerParameter( (ParameterRegistrationImplementor) registerParameter( parameterName, type, mode ) );
|
||||
}
|
||||
catch (HibernateException he) {
|
||||
throw getProducer().convert( he );
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
getProducer().markForRollbackOnly();
|
||||
throw e;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
// outputs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@Override
|
||||
public boolean execute() {
|
||||
try {
|
||||
final Output rtn = outputs().getCurrent();
|
||||
return rtn != null && ResultSetOutput.class.isInstance( rtn );
|
||||
}
|
||||
catch (NoMoreReturnsException e) {
|
||||
return false;
|
||||
}
|
||||
catch (HibernateException he) {
|
||||
throw getProducer().convert( he );
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
getProducer().markForRollbackOnly();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
protected ProcedureOutputs outputs() {
|
||||
if ( procedureResult == null ) {
|
||||
procedureResult = getOutputs();
|
||||
}
|
||||
return procedureResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int executeUpdate() {
|
||||
if ( ! getProducer().isTransactionInProgress() ) {
|
||||
throw new TransactionRequiredException( "javax.persistence.Query.executeUpdate requires active transaction" );
|
||||
}
|
||||
|
||||
// the expectation is that there is just one Output, of type UpdateCountOutput
|
||||
try {
|
||||
execute();
|
||||
return getUpdateCount();
|
||||
}
|
||||
finally {
|
||||
outputs().release();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOutputParameterValue(int position) {
|
||||
// NOTE : according to spec (specifically), an exception thrown from this method should not mark for rollback.
|
||||
try {
|
||||
return outputs().getOutputParameterValue( position );
|
||||
}
|
||||
catch (ParameterStrategyException e) {
|
||||
throw new IllegalArgumentException( "Invalid mix of named and positional parameters", e );
|
||||
}
|
||||
catch (NoSuchParameterException e) {
|
||||
throw new IllegalArgumentException( e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOutputParameterValue(String parameterName) {
|
||||
// NOTE : according to spec (specifically), an exception thrown from this method should not mark for rollback.
|
||||
try {
|
||||
return outputs().getOutputParameterValue( parameterName );
|
||||
}
|
||||
catch (ParameterStrategyException e) {
|
||||
throw new IllegalArgumentException( "Invalid mix of named and positional parameters", e );
|
||||
}
|
||||
catch (NoSuchParameterException e) {
|
||||
throw new IllegalArgumentException( e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMoreResults() {
|
||||
return outputs().goToNext() && ResultSetOutput.class.isInstance( outputs().getCurrent() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUpdateCount() {
|
||||
try {
|
||||
final Output rtn = outputs().getCurrent();
|
||||
if ( rtn == null ) {
|
||||
return -1;
|
||||
}
|
||||
else if ( UpdateCountOutput.class.isInstance( rtn ) ) {
|
||||
return ( (UpdateCountOutput) rtn ).getUpdateCount();
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
catch (NoMoreReturnsException e) {
|
||||
return -1;
|
||||
}
|
||||
catch (HibernateException he) {
|
||||
throw getProducer().convert( he );
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
getProducer().markForRollbackOnly();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<R> getResultList() {
|
||||
try {
|
||||
final Output rtn = outputs().getCurrent();
|
||||
if ( ! ResultSetOutput.class.isInstance( rtn ) ) {
|
||||
throw new IllegalStateException( "Current CallableStatement ou was not a ResultSet, but getResultList was called" );
|
||||
}
|
||||
|
||||
return ( (ResultSetOutput) rtn ).getResultList();
|
||||
}
|
||||
catch (NoMoreReturnsException e) {
|
||||
// todo : the spec is completely silent on these type of edge-case scenarios.
|
||||
// Essentially here we'd have a case where there are no more results (ResultSets nor updateCount) but
|
||||
// getResultList was called.
|
||||
return null;
|
||||
}
|
||||
catch (HibernateException he) {
|
||||
throw getProducer().convert( he );
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
getProducer().markForRollbackOnly();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getSingleResult() {
|
||||
final List<R> resultList = getResultList();
|
||||
if ( resultList == null || resultList.isEmpty() ) {
|
||||
throw new NoResultException(
|
||||
String.format(
|
||||
"Call to stored procedure [%s] returned no results",
|
||||
getProcedureName()
|
||||
)
|
||||
);
|
||||
}
|
||||
else if ( resultList.size() > 1 ) {
|
||||
throw new NonUniqueResultException(
|
||||
String.format(
|
||||
"Call to stored procedure [%s] returned multiple results",
|
||||
getProcedureName()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return resultList.get( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T unwrap(Class<T> cls) {
|
||||
if ( ProcedureCall.class.isAssignableFrom( cls ) ) {
|
||||
return (T) this;
|
||||
}
|
||||
else if ( ProcedureOutputs.class.isAssignableFrom( cls ) ) {
|
||||
return (T) outputs();
|
||||
}
|
||||
else if ( ParameterMetadata.class.isAssignableFrom( cls ) ) {
|
||||
return (T) getParameterMetadata();
|
||||
}
|
||||
else if ( QueryParameterBindings.class.isAssignableFrom( cls ) ) {
|
||||
return (T) getQueryParameterBindings();
|
||||
}
|
||||
|
||||
return super.unwrap( cls );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setLockMode(LockModeType lockMode) {
|
||||
throw new IllegalStateException( "javax.persistence.Query.setLockMode not valid on javax.persistence.StoredProcedureQuery" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public LockModeType getLockMode() {
|
||||
throw new IllegalStateException( "javax.persistence.Query.getHibernateFlushMode not valid on javax.persistence.StoredProcedureQuery" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setHint(String hintName, Object value) {
|
||||
super.setHint( hintName, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setFlushMode(FlushModeType flushModeType) {
|
||||
super.setFlushMode( flushModeType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> ProcedureCallImplementor<R> setParameter(QueryParameter<P> parameter, P value) {
|
||||
super.setParameter( parameter, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> ProcedureCallImplementor<R> setParameter(Parameter<P> parameter, P value) {
|
||||
super.setParameter( parameter, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameter(String name, Object value) {
|
||||
super.setParameter( name, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameter(int position, Object value) {
|
||||
super.setParameter( position, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> ProcedureCallImplementor<R> setParameter(QueryParameter<P> parameter, P value, Type type) {
|
||||
super.setParameter( parameter, value, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameter(String name, Object value, Type type) {
|
||||
super.setParameter( name, value, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameter(int position, Object value, Type type) {
|
||||
super.setParameter( position, value, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> ProcedureCallImplementor<R> setParameter(QueryParameter<P> parameter, P value, TemporalType temporalType) {
|
||||
super.setParameter( parameter, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameter(String name, Object value, TemporalType temporalType) {
|
||||
super.setParameter( name, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameter(int position, Object value, TemporalType temporalType) {
|
||||
super.setParameter( position, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameterList(QueryParameter parameter, Collection values) {
|
||||
super.setParameterList( parameter, values );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameterList(String name, Collection values) {
|
||||
super.setParameterList( name, values );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameterList(String name, Collection values, Type type) {
|
||||
super.setParameterList( name, values, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameterList(String name, Object[] values, Type type) {
|
||||
super.setParameterList( name, values, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameterList(String name, Object[] values) {
|
||||
super.setParameterList( name, values );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameter(Parameter param, Calendar value, TemporalType temporalType) {
|
||||
super.setParameter( param, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameter(Parameter param, Date value, TemporalType temporalType) {
|
||||
super.setParameter( param, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameter(String name, Calendar value, TemporalType temporalType) {
|
||||
super.setParameter( name, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameter(String name, Date value, TemporalType temporalType) {
|
||||
super.setParameter( name, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameter(int position, Calendar value, TemporalType temporalType) {
|
||||
super.setParameter( position, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameter(int position, Date value, TemporalType temporalType) {
|
||||
super.setParameter( position, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* 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.procedure.spi;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import javax.persistence.FlushModeType;
|
||||
import javax.persistence.Parameter;
|
||||
import javax.persistence.ParameterMode;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
import org.hibernate.procedure.ProcedureCall;
|
||||
import org.hibernate.query.spi.QueryImplementor;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface ProcedureCallImplementor<R> extends ProcedureCall, QueryImplementor<R> {
|
||||
@Override
|
||||
ProcedureCallImplementor<R> setHint(String hintName, Object value);
|
||||
|
||||
@Override
|
||||
<T> ProcedureCallImplementor<R> setParameter(Parameter<T> param, T value);
|
||||
|
||||
@Override
|
||||
ProcedureCallImplementor<R> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
ProcedureCallImplementor<R> setParameter(Parameter<Date> param, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
ProcedureCallImplementor<R> setParameter(String name, Object value);
|
||||
|
||||
@Override
|
||||
ProcedureCallImplementor<R> setParameter(String name, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
ProcedureCallImplementor<R> setParameter(String name, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
ProcedureCallImplementor<R> setParameter(int position, Object value);
|
||||
|
||||
@Override
|
||||
ProcedureCallImplementor<R> setParameter(int position, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
ProcedureCallImplementor<R> setParameter(int position, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
ProcedureCallImplementor<R> setFlushMode(FlushModeType flushMode);
|
||||
|
||||
@Override
|
||||
ProcedureCallImplementor<R> registerStoredProcedureParameter(int position, Class type, ParameterMode mode);
|
||||
|
||||
@Override
|
||||
ProcedureCallImplementor<R> registerStoredProcedureParameter(String parameterName, Class type, ParameterMode mode);
|
||||
}
|
|
@ -6,13 +6,104 @@
|
|||
*/
|
||||
package org.hibernate.query;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import javax.persistence.Parameter;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.SQLQuery;
|
||||
import org.hibernate.SynchronizeableQuery;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface NativeQuery extends Query<Object>, SQLQuery {
|
||||
public interface NativeQuery<T> extends Query<T>, SQLQuery<T>, SynchronizeableQuery<T> {
|
||||
@Override
|
||||
NativeQuery setFlushMode(FlushMode flushMode);
|
||||
NativeQuery<T> setFlushMode(FlushMode flushMode);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setResultSetMapping(String name);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameter(Parameter<P> param, P value);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val, Type type);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(String name, Object val, Type type);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, Object val, Type type);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(String name, Object val, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, Object val, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(Parameter<Date> param, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(String name, Object value);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(String name, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(String name, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, Object value);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, Collection<P> values);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameterList(String name, Collection values);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameterList(String name, Collection values, Type type);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameterList(String name, Object[] values, Type type);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameterList(String name, Object[] values);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setProperties(Object bean);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setProperties(Map bean);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> addSynchronizedQuerySpace(String querySpace);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> addSynchronizedEntityName(String entityName) throws MappingException;
|
||||
|
||||
@Override
|
||||
NativeQuery<T> addSynchronizedEntityClass(Class entityClass) throws MappingException;
|
||||
}
|
||||
|
|
|
@ -88,41 +88,41 @@ public interface Query<R> extends TypedQuery<R>, org.hibernate.Query<R>, BasicQu
|
|||
Query<R> setLockMode(LockModeType lockMode);
|
||||
|
||||
@Override
|
||||
Query setReadOnly(boolean readOnly);
|
||||
Query<R> setReadOnly(boolean readOnly);
|
||||
|
||||
@Override
|
||||
Query setHibernateFlushMode(FlushMode flushMode);
|
||||
Query<R> setHibernateFlushMode(FlushMode flushMode);
|
||||
|
||||
@Override
|
||||
default Query setFlushMode(FlushMode flushMode) {
|
||||
default Query<R> setFlushMode(FlushMode flushMode) {
|
||||
setHibernateFlushMode( flushMode );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
Query setCacheMode(CacheMode cacheMode);
|
||||
Query<R> setCacheMode(CacheMode cacheMode);
|
||||
|
||||
@Override
|
||||
Query setCacheable(boolean cacheable);
|
||||
Query<R> setCacheable(boolean cacheable);
|
||||
|
||||
@Override
|
||||
Query setCacheRegion(String cacheRegion);
|
||||
Query<R> setCacheRegion(String cacheRegion);
|
||||
|
||||
@Override
|
||||
Query setTimeout(int timeout);
|
||||
Query<R> setTimeout(int timeout);
|
||||
|
||||
@Override
|
||||
Query setFetchSize(int fetchSize);
|
||||
Query<R> setFetchSize(int fetchSize);
|
||||
|
||||
@Override
|
||||
Query setLockOptions(LockOptions lockOptions);
|
||||
Query<R> setLockOptions(LockOptions lockOptions);
|
||||
|
||||
@Override
|
||||
Query setLockMode(String alias, LockMode lockMode);
|
||||
Query<R> setLockMode(String alias, LockMode lockMode);
|
||||
|
||||
@Override
|
||||
Query setComment(String comment);
|
||||
Query<R> setComment(String comment);
|
||||
|
||||
@Override
|
||||
Query addQueryHint(String hint);
|
||||
Query<R> addQueryHint(String hint);
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ import org.hibernate.internal.HEMLogging;
|
|||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.jpa.AvailableSettings;
|
||||
import org.hibernate.jpa.QueryHints;
|
||||
import org.hibernate.jpa.TypedParameterValue;
|
||||
import org.hibernate.jpa.graph.internal.EntityGraphImpl;
|
||||
import org.hibernate.jpa.internal.util.CacheModeHelper;
|
||||
import org.hibernate.jpa.internal.util.ConfigurationHelper;
|
||||
|
@ -293,22 +294,41 @@ public abstract class AbstractProducedQuery<R> implements QueryImplementor<R> {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public QueryImplementor setParameter(QueryParameter parameter, Object value) {
|
||||
public <P> QueryImplementor setParameter(QueryParameter<P> parameter, P value) {
|
||||
queryParameterBindings.getBinding( parameter ).setBindValue( value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public QueryImplementor setParameter(Parameter parameter, Object value) {
|
||||
queryParameterBindings.getBinding( (QueryParameter) parameter ).setBindValue( value );
|
||||
public <P> QueryImplementor setParameter(Parameter<P> parameter, P value) {
|
||||
if ( value instanceof TypedParameterValue ) {
|
||||
final TypedParameterValue typedValueWrapper = (TypedParameterValue ) value;
|
||||
setParameter( (QueryParameter) parameter, typedValueWrapper.getValue(), typedValueWrapper.getType() );
|
||||
}
|
||||
else if ( value instanceof Collection ) {
|
||||
setParameterList( (QueryParameter) parameter, (Collection) value );
|
||||
}
|
||||
else {
|
||||
queryParameterBindings.getBinding( (QueryParameter) parameter ).setBindValue( value );
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public QueryImplementor setParameter(String name, Object value) {
|
||||
queryParameterBindings.getBinding( name ).setBindValue( value );
|
||||
if ( value instanceof TypedParameterValue ) {
|
||||
final TypedParameterValue typedValueWrapper = (TypedParameterValue ) value;
|
||||
setParameter( name, typedValueWrapper.getValue(), typedValueWrapper.getType() );
|
||||
}
|
||||
else if ( value instanceof Collection ) {
|
||||
setParameterList( name, (Collection) value );
|
||||
}
|
||||
else {
|
||||
queryParameterBindings.getBinding( name ).setBindValue( value );
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -321,7 +341,7 @@ public abstract class AbstractProducedQuery<R> implements QueryImplementor<R> {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public QueryImplementor setParameter(QueryParameter parameter, Object value, Type type) {
|
||||
public <P> QueryImplementor setParameter(QueryParameter<P> parameter, P value, Type type) {
|
||||
queryParameterBindings.getBinding( parameter ).setBindValue( value, type );
|
||||
return this;
|
||||
}
|
||||
|
@ -342,7 +362,7 @@ public abstract class AbstractProducedQuery<R> implements QueryImplementor<R> {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public QueryImplementor setParameter(QueryParameter parameter, Object value, TemporalType temporalType) {
|
||||
public <P> QueryImplementor setParameter(QueryParameter<P> parameter, P value, TemporalType temporalType) {
|
||||
queryParameterBindings.getBinding( parameter ).setBindValue( value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
@ -363,7 +383,7 @@ public abstract class AbstractProducedQuery<R> implements QueryImplementor<R> {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public QueryImplementor setParameterList(QueryParameter parameter, Collection values) {
|
||||
public <P> QueryImplementor<R> setParameterList(QueryParameter<P> parameter, Collection<P> values) {
|
||||
queryParameterBindings.getQueryParameterListBinding( parameter ).setBindValues( values );
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ import org.hibernate.type.Type;
|
|||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class NativeQueryImpl extends AbstractProducedQuery<Object> implements NativeQueryImplementor {
|
||||
public class NativeQueryImpl<T> extends AbstractProducedQuery<T> implements NativeQueryImplementor<T> {
|
||||
private final String sqlString;
|
||||
private List<NativeSQLQueryReturn> queryReturns;
|
||||
private List<NativeQueryReturnBuilder> queryReturnBuilders;
|
||||
|
@ -137,7 +137,7 @@ public class NativeQueryImpl extends AbstractProducedQuery<Object> implements Na
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected List<Object> doList() {
|
||||
protected List<T> doList() {
|
||||
return getProducer().list(
|
||||
generateQuerySpecification(),
|
||||
getQueryParameters()
|
||||
|
@ -244,12 +244,12 @@ public class NativeQueryImpl extends AbstractProducedQuery<Object> implements Na
|
|||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor addScalar(String columnAlias) {
|
||||
public NativeQueryImplementor<T> addScalar(String columnAlias) {
|
||||
return addScalar( columnAlias, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor addScalar(String columnAlias, Type type) {
|
||||
public NativeQueryImplementor<T> addScalar(String columnAlias, Type type) {
|
||||
addReturnBuilder(
|
||||
new NativeQueryReturnBuilder() {
|
||||
public NativeSQLQueryReturn buildReturn() {
|
||||
|
@ -281,34 +281,34 @@ public class NativeQueryImpl extends AbstractProducedQuery<Object> implements Na
|
|||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor addEntity(String entityName) {
|
||||
public NativeQueryImplementor<T> addEntity(String entityName) {
|
||||
return addEntity( StringHelper.unqualify( entityName ), entityName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor addEntity(String tableAlias, String entityName) {
|
||||
public NativeQueryImplementor<T> addEntity(String tableAlias, String entityName) {
|
||||
addRoot( tableAlias, entityName );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor addEntity(String tableAlias, String entityName, LockMode lockMode) {
|
||||
public NativeQueryImplementor<T> addEntity(String tableAlias, String entityName, LockMode lockMode) {
|
||||
addRoot( tableAlias, entityName ).setLockMode( lockMode );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor addEntity(Class entityType) {
|
||||
public NativeQueryImplementor<T> addEntity(Class entityType) {
|
||||
return addEntity( entityType.getName() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor addEntity(String tableAlias, Class entityClass) {
|
||||
public NativeQueryImplementor<T> addEntity(String tableAlias, Class entityClass) {
|
||||
return addEntity( tableAlias, entityClass.getName() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor addEntity(String tableAlias, Class entityClass, LockMode lockMode) {
|
||||
public NativeQueryImplementor<T> addEntity(String tableAlias, Class entityClass, LockMode lockMode) {
|
||||
return addEntity( tableAlias, entityClass.getName(), lockMode );
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ public class NativeQueryImpl extends AbstractProducedQuery<Object> implements Na
|
|||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor addJoin(String tableAlias, String path) {
|
||||
public NativeQueryImplementor<T> addJoin(String tableAlias, String path) {
|
||||
createFetchJoin( tableAlias, path );
|
||||
return this;
|
||||
}
|
||||
|
@ -336,13 +336,13 @@ public class NativeQueryImpl extends AbstractProducedQuery<Object> implements Na
|
|||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor addJoin(String tableAlias, String ownerTableAlias, String joinPropertyName) {
|
||||
public NativeQueryImplementor<T> addJoin(String tableAlias, String ownerTableAlias, String joinPropertyName) {
|
||||
addFetch( tableAlias, ownerTableAlias, joinPropertyName );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor addJoin(String tableAlias, String path, LockMode lockMode) {
|
||||
public NativeQueryImplementor<T> addJoin(String tableAlias, String path, LockMode lockMode) {
|
||||
createFetchJoin( tableAlias, path ).setLockMode( lockMode );
|
||||
return this;
|
||||
}
|
||||
|
@ -358,13 +358,13 @@ public class NativeQueryImpl extends AbstractProducedQuery<Object> implements Na
|
|||
}
|
||||
|
||||
@Override
|
||||
public NativeQuery setEntity(int position, Object val) {
|
||||
public NativeQueryImplementor<T> setEntity(int position, Object val) {
|
||||
setParameter( position, val, getProducer().getFactory().getTypeHelper().entity( resolveEntityName( val ) ) );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQuery setEntity(String name, Object val) {
|
||||
public NativeQueryImplementor<T> setEntity(String name, Object val) {
|
||||
setParameter( name, val, getProducer().getFactory().getTypeHelper().entity( resolveEntityName( val ) ) );
|
||||
return this;
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ public class NativeQueryImpl extends AbstractProducedQuery<Object> implements Na
|
|||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor addSynchronizedQuerySpace(String querySpace) {
|
||||
public NativeQueryImplementor<T> addSynchronizedQuerySpace(String querySpace) {
|
||||
addQuerySpaces( querySpace );
|
||||
return this;
|
||||
}
|
||||
|
@ -399,13 +399,13 @@ public class NativeQueryImpl extends AbstractProducedQuery<Object> implements Na
|
|||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor addSynchronizedEntityName(String entityName) throws MappingException {
|
||||
public NativeQueryImplementor<T> addSynchronizedEntityName(String entityName) throws MappingException {
|
||||
addQuerySpaces( getProducer().getFactory().getMetamodel().entityPersister( entityName ).getQuerySpaces() );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor addSynchronizedEntityClass(Class entityClass) throws MappingException {
|
||||
public NativeQueryImplementor<T> addSynchronizedEntityClass(Class entityClass) throws MappingException {
|
||||
addQuerySpaces( getProducer().getFactory().getMetamodel().entityPersister( entityClass.getName() ).getQuerySpaces() );
|
||||
return this;
|
||||
}
|
||||
|
@ -416,132 +416,133 @@ public class NativeQueryImpl extends AbstractProducedQuery<Object> implements Na
|
|||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setHibernateFlushMode(FlushMode flushMode) {
|
||||
public NativeQueryImplementor<T> setHibernateFlushMode(FlushMode flushMode) {
|
||||
super.setHibernateFlushMode( flushMode );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setFlushMode(FlushMode flushMode) {
|
||||
public NativeQueryImplementor<T> setFlushMode(FlushMode flushMode) {
|
||||
super.setFlushMode( flushMode );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setFlushMode(FlushModeType flushModeType) {
|
||||
public NativeQueryImplementor<T> setFlushMode(FlushModeType flushModeType) {
|
||||
super.setFlushMode( flushModeType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setCacheMode(CacheMode cacheMode) {
|
||||
public NativeQueryImplementor<T> setCacheMode(CacheMode cacheMode) {
|
||||
super.setCacheMode( cacheMode );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setCacheable(boolean cacheable) {
|
||||
public NativeQueryImplementor<T> setCacheable(boolean cacheable) {
|
||||
super.setCacheable( cacheable );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setCacheRegion(String cacheRegion) {
|
||||
public NativeQueryImplementor<T> setCacheRegion(String cacheRegion) {
|
||||
super.setCacheRegion( cacheRegion );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setTimeout(int timeout) {
|
||||
public NativeQueryImplementor<T> setTimeout(int timeout) {
|
||||
super.setTimeout( timeout );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setFetchSize(int fetchSize) {
|
||||
public NativeQueryImplementor<T> setFetchSize(int fetchSize) {
|
||||
super.setFetchSize( fetchSize );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setReadOnly(boolean readOnly) {
|
||||
public NativeQueryImplementor<T> setReadOnly(boolean readOnly) {
|
||||
super.setReadOnly( readOnly );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setLockOptions(LockOptions lockOptions) {
|
||||
public NativeQueryImplementor<T> setLockOptions(LockOptions lockOptions) {
|
||||
super.setLockOptions( lockOptions );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setLockMode(String alias, LockMode lockMode) {
|
||||
public NativeQueryImplementor<T> setLockMode(String alias, LockMode lockMode) {
|
||||
super.setLockMode( alias, lockMode );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setLockMode(LockModeType lockModeType) {
|
||||
public NativeQueryImplementor<T> setLockMode(LockModeType lockModeType) {
|
||||
throw new IllegalStateException( "Illegal attempt to set lock mode on a native SQL query" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setComment(String comment) {
|
||||
public NativeQueryImplementor<T> setComment(String comment) {
|
||||
super.setComment( comment );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor addQueryHint(String hint) {
|
||||
public NativeQueryImplementor<T> addQueryHint(String hint) {
|
||||
super.addQueryHint( hint );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setParameter(QueryParameter parameter, Object value) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public NativeQueryImplementor<T> setParameter(QueryParameter parameter, Object value) {
|
||||
super.setParameter( (Parameter<Object>) parameter, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<T> setParameter(Parameter<P> parameter, P value) {
|
||||
super.setParameter( parameter, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setParameter(Parameter parameter, Object value) {
|
||||
super.setParameter( parameter, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setParameter(String name, Object value) {
|
||||
public NativeQueryImplementor<T> setParameter(String name, Object value) {
|
||||
super.setParameter( name, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setParameter(int position, Object value) {
|
||||
public NativeQueryImplementor<T> setParameter(int position, Object value) {
|
||||
super.setParameter( position, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setParameter(QueryParameter parameter, Object value, Type type) {
|
||||
public NativeQueryImplementor<T> setParameter(QueryParameter parameter, Object value, Type type) {
|
||||
super.setParameter( parameter, value, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setParameter(String name, Object value, Type type) {
|
||||
public NativeQueryImplementor<T> setParameter(String name, Object value, Type type) {
|
||||
super.setParameter( name, value, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setParameter(int position, Object value, Type type) {
|
||||
public NativeQueryImplementor<T> setParameter(int position, Object value, Type type) {
|
||||
super.setParameter( position, value, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor setParameter(QueryParameter parameter, Object value, TemporalType temporalType) {
|
||||
public <P> NativeQueryImplementor<T> setParameter(QueryParameter<P> parameter, P value, TemporalType temporalType) {
|
||||
super.setParameter( parameter, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -1,632 +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.procedure.internal;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.persistence.FlushModeType;
|
||||
import javax.persistence.LockModeType;
|
||||
import javax.persistence.NoResultException;
|
||||
import javax.persistence.NonUniqueResultException;
|
||||
import javax.persistence.Parameter;
|
||||
import javax.persistence.ParameterMode;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.TransactionRequiredException;
|
||||
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.jpa.TypedParameterValue;
|
||||
import org.hibernate.procedure.NoSuchParameterException;
|
||||
import org.hibernate.procedure.ParameterStrategyException;
|
||||
import org.hibernate.procedure.ProcedureCall;
|
||||
import org.hibernate.procedure.ProcedureCallMemento;
|
||||
import org.hibernate.procedure.ProcedureOutputs;
|
||||
import org.hibernate.procedure.spi.ParameterRegistrationImplementor;
|
||||
import org.hibernate.query.ParameterMetadata;
|
||||
import org.hibernate.query.QueryParameter;
|
||||
import org.hibernate.query.internal.AbstractProducedQuery;
|
||||
import org.hibernate.query.procedure.spi.ProcedureParameterImplementor;
|
||||
import org.hibernate.query.procedure.spi.StoredProcedureQueryImplementor;
|
||||
import org.hibernate.query.spi.QueryParameterBindings;
|
||||
import org.hibernate.result.NoMoreReturnsException;
|
||||
import org.hibernate.result.Output;
|
||||
import org.hibernate.result.ResultSetOutput;
|
||||
import org.hibernate.result.UpdateCountOutput;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* Defines support for JPA-defined stored-procedure execution. This is the one Query form
|
||||
* that still uses wrapping as there are very fundamental differences between Hibernate's
|
||||
* native procedure support and JPA's.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class StoredProcedureQueryImpl extends AbstractProducedQuery<Object> implements StoredProcedureQueryImplementor {
|
||||
private final ProcedureCall procedureCall;
|
||||
private ProcedureOutputs procedureResult;
|
||||
|
||||
private ProcedureParameterMetadata parameterMetadata = new ProcedureParameterMetadata();
|
||||
private ProcedureParameterBindings parameterBindings = new ProcedureParameterBindings();
|
||||
|
||||
public StoredProcedureQueryImpl(ProcedureCall procedureCall, SessionImplementor session) {
|
||||
super( session, null );
|
||||
this.procedureCall = procedureCall;
|
||||
}
|
||||
|
||||
/**
|
||||
* This form is used to build a StoredProcedureQueryImpl from a memento (usually from a NamedStoredProcedureQuery).
|
||||
*
|
||||
* @param memento The memento
|
||||
* @param entityManager The EntityManager
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public StoredProcedureQueryImpl(ProcedureCallMemento memento, SessionImplementor entityManager) {
|
||||
super( entityManager, null );
|
||||
this.procedureCall = memento.makeProcedureCall( entityManager.getSession() );
|
||||
for ( org.hibernate.procedure.ParameterRegistration nativeParamReg : procedureCall.getRegisteredParameters() ) {
|
||||
registerParameter( (ParameterRegistrationImplementor) nativeParamReg );
|
||||
}
|
||||
}
|
||||
|
||||
private <T> void registerParameter(ParameterRegistrationImplementor<T> nativeParamRegistration) {
|
||||
registerParameter( new ProcedureParameterImpl<>( nativeParamRegistration ) );
|
||||
}
|
||||
|
||||
private <T> void registerParameter(ProcedureParameterImplementor<T> parameter) {
|
||||
parameterMetadata.registerParameter( parameter );
|
||||
parameterBindings.registerParameter( parameter );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public StoredProcedureQueryImplementor registerStoredProcedureParameter(int position, Class type, ParameterMode mode) {
|
||||
getProducer().checkOpen( true );
|
||||
|
||||
try {
|
||||
registerParameter( (ParameterRegistrationImplementor) procedureCall.registerParameter( position, type, mode ) );
|
||||
}
|
||||
catch (HibernateException he) {
|
||||
throw getProducer().convert( he );
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
getProducer().markForRollbackOnly();
|
||||
throw e;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public StoredProcedureQueryImplementor registerStoredProcedureParameter(String parameterName, Class type, ParameterMode mode) {
|
||||
getProducer().checkOpen( true );
|
||||
|
||||
try {
|
||||
registerParameter( (ParameterRegistrationImplementor) procedureCall.registerParameter( parameterName, type, mode ) );
|
||||
}
|
||||
catch (HibernateException he) {
|
||||
throw getProducer().convert( he );
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
getProducer().markForRollbackOnly();
|
||||
throw e;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SessionImplementor getProducer() {
|
||||
return (SessionImplementor) super.getProducer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCall getHibernateProcedureCall() {
|
||||
return procedureCall;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryString() {
|
||||
return procedureCall.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type[] getReturnTypes() {
|
||||
return procedureCall.getReturnTypes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getReturnAliases() {
|
||||
throw new UnsupportedOperationException( "Procedure/function calls do not support returning aliases" );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean applyTimeoutHint(int timeout) {
|
||||
procedureCall.setTimeout( timeout );
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean applyCacheableHint(boolean isCacheable) {
|
||||
procedureCall.setCacheable( isCacheable );
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean applyCacheRegionHint(String regionName) {
|
||||
procedureCall.setCacheRegion( regionName );
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean applyReadOnlyHint(boolean isReadOnly) {
|
||||
procedureCall.setReadOnly( isReadOnly );
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean applyCacheModeHint(CacheMode cacheMode) {
|
||||
procedureCall.setCacheMode( cacheMode );
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean applyFlushModeHint(FlushMode flushMode) {
|
||||
procedureCall.setHibernateFlushMode( flushMode );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// outputs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@Override
|
||||
public boolean execute() {
|
||||
try {
|
||||
final Output rtn = outputs().getCurrent();
|
||||
return rtn != null && ResultSetOutput.class.isInstance( rtn );
|
||||
}
|
||||
catch (NoMoreReturnsException e) {
|
||||
return false;
|
||||
}
|
||||
catch (HibernateException he) {
|
||||
throw getProducer().convert( he );
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
getProducer().markForRollbackOnly();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
protected ProcedureOutputs outputs() {
|
||||
if ( procedureResult == null ) {
|
||||
procedureResult = procedureCall.getOutputs();
|
||||
}
|
||||
return procedureResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int executeUpdate() {
|
||||
if ( ! getProducer().isTransactionInProgress() ) {
|
||||
throw new TransactionRequiredException( "javax.persistence.Query.executeUpdate requires active transaction" );
|
||||
}
|
||||
|
||||
// the expectation is that there is just one Output, of type UpdateCountOutput
|
||||
try {
|
||||
execute();
|
||||
return getUpdateCount();
|
||||
}
|
||||
finally {
|
||||
outputs().release();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOutputParameterValue(int position) {
|
||||
// NOTE : according to spec (specifically), an exception thrown from this method should not mark for rollback.
|
||||
try {
|
||||
return outputs().getOutputParameterValue( position );
|
||||
}
|
||||
catch (ParameterStrategyException e) {
|
||||
throw new IllegalArgumentException( "Invalid mix of named and positional parameters", e );
|
||||
}
|
||||
catch (NoSuchParameterException e) {
|
||||
throw new IllegalArgumentException( e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOutputParameterValue(String parameterName) {
|
||||
// NOTE : according to spec (specifically), an exception thrown from this method should not mark for rollback.
|
||||
try {
|
||||
return outputs().getOutputParameterValue( parameterName );
|
||||
}
|
||||
catch (ParameterStrategyException e) {
|
||||
throw new IllegalArgumentException( "Invalid mix of named and positional parameters", e );
|
||||
}
|
||||
catch (NoSuchParameterException e) {
|
||||
throw new IllegalArgumentException( e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMoreResults() {
|
||||
return outputs().goToNext() && ResultSetOutput.class.isInstance( outputs().getCurrent() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUpdateCount() {
|
||||
try {
|
||||
final Output rtn = outputs().getCurrent();
|
||||
if ( rtn == null ) {
|
||||
return -1;
|
||||
}
|
||||
else if ( UpdateCountOutput.class.isInstance( rtn ) ) {
|
||||
return ( (UpdateCountOutput) rtn ).getUpdateCount();
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
catch (NoMoreReturnsException e) {
|
||||
return -1;
|
||||
}
|
||||
catch (HibernateException he) {
|
||||
throw getProducer().convert( he );
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
getProducer().markForRollbackOnly();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List getResultList() {
|
||||
try {
|
||||
final Output rtn = outputs().getCurrent();
|
||||
if ( ! ResultSetOutput.class.isInstance( rtn ) ) {
|
||||
throw new IllegalStateException( "Current CallableStatement ou was not a ResultSet, but getResultList was called" );
|
||||
}
|
||||
|
||||
return ( (ResultSetOutput) rtn ).getResultList();
|
||||
}
|
||||
catch (NoMoreReturnsException e) {
|
||||
// todo : the spec is completely silent on these type of edge-case scenarios.
|
||||
// Essentially here we'd have a case where there are no more results (ResultSets nor updateCount) but
|
||||
// getResultList was called.
|
||||
return null;
|
||||
}
|
||||
catch (HibernateException he) {
|
||||
throw getProducer().convert( he );
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
getProducer().markForRollbackOnly();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSingleResult() {
|
||||
final List resultList = getResultList();
|
||||
if ( resultList == null || resultList.isEmpty() ) {
|
||||
throw new NoResultException(
|
||||
String.format(
|
||||
"Call to stored procedure [%s] returned no results",
|
||||
procedureCall.getProcedureName()
|
||||
)
|
||||
);
|
||||
}
|
||||
else if ( resultList.size() > 1 ) {
|
||||
throw new NonUniqueResultException(
|
||||
String.format(
|
||||
"Call to stored procedure [%s] returned multiple results",
|
||||
procedureCall.getProcedureName()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return resultList.get( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object unwrap(Class cls) {
|
||||
if ( ProcedureCall.class.isAssignableFrom( cls ) ) {
|
||||
return procedureCall;
|
||||
}
|
||||
else if ( ProcedureOutputs.class.isAssignableFrom( cls ) ) {
|
||||
return outputs();
|
||||
}
|
||||
else if ( ParameterMetadata.class.isAssignableFrom( cls ) ) {
|
||||
return parameterMetadata;
|
||||
}
|
||||
else if ( QueryParameterBindings.class.isAssignableFrom( cls ) ) {
|
||||
return parameterBindings;
|
||||
}
|
||||
|
||||
return super.unwrap( cls );
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoredProcedureQueryImpl setLockMode(LockModeType lockMode) {
|
||||
throw new IllegalStateException( "javax.persistence.Query.setLockMode not valid on javax.persistence.StoredProcedureQuery" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public LockModeType getLockMode() {
|
||||
throw new IllegalStateException( "javax.persistence.Query.getHibernateFlushMode not valid on javax.persistence.StoredProcedureQuery" );
|
||||
}
|
||||
|
||||
|
||||
// unsupported hints/calls ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean canApplyAliasSpecificLockModeHints() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyAliasSpecificLockModeHint(String alias, LockMode lockMode) {
|
||||
throw new UnsupportedOperationException( "Applying alias-specific LockModes is not available for callable queries" );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isNativeQuery() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean applyLockTimeoutHint(int timeout) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean applyCommentHint(String comment) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean applyFetchSizeHint(int fetchSize) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// covariant returns
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public StoredProcedureQueryImplementor setParameter(QueryParameter parameter, Object value) {
|
||||
super.setParameter( parameter, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public StoredProcedureQueryImplementor setParameter(Parameter parameter, Object value) {
|
||||
super.setParameter( parameter, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoredProcedureQueryImplementor setParameter(Parameter param, Calendar value, TemporalType temporalType) {
|
||||
super.setParameter( param, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoredProcedureQueryImplementor setParameter(Parameter param, Date value, TemporalType temporalType) {
|
||||
super.setParameter( param, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoredProcedureQueryImplementor setParameter(String name, Object value) {
|
||||
super.setParameter( name, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoredProcedureQueryImplementor setParameter(String name, Calendar value, TemporalType temporalType) {
|
||||
super.setParameter( name, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoredProcedureQueryImplementor setParameter(String name, Date value, TemporalType temporalType) {
|
||||
super.setParameter( name, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoredProcedureQueryImplementor setParameter(int position, Object value) {
|
||||
super.setParameter( position, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoredProcedureQueryImplementor setEntity(int position, Object val) {
|
||||
setParameter( position, val, getProducer().getFactory().getTypeHelper().entity( resolveEntityName( val ) ) );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoredProcedureQueryImplementor setEntity(String name, Object val) {
|
||||
setParameter( name, val, getProducer().getFactory().getTypeHelper().entity( resolveEntityName( val ) ) );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoredProcedureQueryImplementor setParameter(int position, Calendar value, TemporalType temporalType) {
|
||||
super.setParameter( position, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoredProcedureQueryImplementor setParameter(int position, Date value, TemporalType temporalType) {
|
||||
super.setParameter( position, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoredProcedureQueryImplementor setFlushMode(FlushModeType jpaFlushMode) {
|
||||
super.setFlushMode( jpaFlushMode );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoredProcedureQueryImplementor setHint(String hintName, Object value) {
|
||||
super.setHint( hintName, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoredProcedureQueryImplementor setFirstResult(int startPosition) {
|
||||
super.setFirstResult( startPosition );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoredProcedureQueryImplementor setMaxResults(int maxResult) {
|
||||
super.setMaxResults( maxResult );
|
||||
return this;
|
||||
}
|
||||
|
||||
// parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
protected static void validateBinding(Class parameterType, Object bind, TemporalType temporalType) {
|
||||
if ( bind == null || parameterType == null ) {
|
||||
// nothing we can check
|
||||
return;
|
||||
}
|
||||
|
||||
if ( bind instanceof TypedParameterValue ) {
|
||||
bind = ( (TypedParameterValue ) bind ).getValue();
|
||||
}
|
||||
|
||||
if ( Collection.class.isInstance( bind ) && ! Collection.class.isAssignableFrom( parameterType ) ) {
|
||||
// we have a collection passed in where we are expecting a non-collection.
|
||||
// NOTE : this can happen in Hibernate's notion of "parameter list" binding
|
||||
// NOTE2 : the case of a collection value and an expected collection (if that can even happen)
|
||||
// will fall through to the main check.
|
||||
validateCollectionValuedParameterBinding( parameterType, (Collection) bind, temporalType );
|
||||
}
|
||||
else if ( bind.getClass().isArray() ) {
|
||||
validateArrayValuedParameterBinding( parameterType, bind, temporalType );
|
||||
}
|
||||
else {
|
||||
if ( ! isValidBindValue( parameterType, bind, temporalType ) ) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"Parameter value [%s] did not match expected type [%s (%s)]",
|
||||
bind,
|
||||
parameterType.getName(),
|
||||
extractName( temporalType )
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String extractName(TemporalType temporalType) {
|
||||
return temporalType == null ? "n/a" : temporalType.name();
|
||||
}
|
||||
|
||||
private static void validateCollectionValuedParameterBinding(
|
||||
Class parameterType,
|
||||
Collection value,
|
||||
TemporalType temporalType) {
|
||||
// validate the elements...
|
||||
for ( Object element : value ) {
|
||||
if ( ! isValidBindValue( parameterType, element, temporalType ) ) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"Parameter value element [%s] did not match expected type [%s (%s)]",
|
||||
element,
|
||||
parameterType.getName(),
|
||||
extractName( temporalType )
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void validateArrayValuedParameterBinding(
|
||||
Class parameterType,
|
||||
Object value,
|
||||
TemporalType temporalType) {
|
||||
if ( ! parameterType.isArray() ) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"Encountered array-valued parameter binding, but was expecting [%s (%s)]",
|
||||
parameterType.getName(),
|
||||
extractName( temporalType )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ( value.getClass().getComponentType().isPrimitive() ) {
|
||||
// we have a primitive array. we validate that the actual array has the component type (type of elements)
|
||||
// we expect based on the component type of the parameter specification
|
||||
if ( ! parameterType.getComponentType().isAssignableFrom( value.getClass().getComponentType() ) ) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"Primitive array-valued parameter bind value type [%s] did not match expected type [%s (%s)]",
|
||||
value.getClass().getComponentType().getName(),
|
||||
parameterType.getName(),
|
||||
extractName( temporalType )
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// we have an object array. Here we loop over the array and physically check each element against
|
||||
// the type we expect based on the component type of the parameter specification
|
||||
final Object[] array = (Object[]) value;
|
||||
for ( Object element : array ) {
|
||||
if ( ! isValidBindValue( parameterType.getComponentType(), element, temporalType ) ) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"Array-valued parameter value element [%s] did not match expected type [%s (%s)]",
|
||||
element,
|
||||
parameterType.getName(),
|
||||
extractName( temporalType )
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static boolean isValidBindValue(Class expectedType, Object value, TemporalType temporalType) {
|
||||
if ( expectedType.isInstance( value ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( temporalType != null ) {
|
||||
final boolean parameterDeclarationIsTemporal = Date.class.isAssignableFrom( expectedType )
|
||||
|| Calendar.class.isAssignableFrom( expectedType );
|
||||
final boolean bindIsTemporal = Date.class.isInstance( value )
|
||||
|| Calendar.class.isInstance( value );
|
||||
|
||||
if ( parameterDeclarationIsTemporal && bindIsTemporal ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -28,159 +28,159 @@ import org.hibernate.type.Type;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
@Incubating
|
||||
public interface NativeQueryImplementor extends QueryImplementor<Object>, NativeQuery {
|
||||
public interface NativeQueryImplementor<T> extends QueryImplementor<T>, NativeQuery<T> {
|
||||
NativeQueryImplementor setCollectionKey(Serializable key);
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// overrides
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor addScalar(String columnAlias);
|
||||
NativeQueryImplementor<T> addScalar(String columnAlias);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor addScalar(String columnAlias, Type type);
|
||||
NativeQueryImplementor<T> addScalar(String columnAlias, Type type);
|
||||
|
||||
@Override
|
||||
RootReturn addRoot(String tableAlias, String entityName);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor addEntity(String entityName);
|
||||
NativeQueryImplementor<T> addEntity(String entityName);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor addEntity(String tableAlias, String entityName);
|
||||
NativeQueryImplementor<T> addEntity(String tableAlias, String entityName);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor addEntity(String tableAlias, String entityName, LockMode lockMode);
|
||||
NativeQueryImplementor<T> addEntity(String tableAlias, String entityName, LockMode lockMode);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor addEntity(Class entityType);
|
||||
NativeQueryImplementor<T> addEntity(Class entityType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor addEntity(String tableAlias, Class entityType);
|
||||
NativeQueryImplementor<T> addEntity(String tableAlias, Class entityType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor addEntity(String tableAlias, Class entityClass, LockMode lockMode);
|
||||
NativeQueryImplementor<T> addEntity(String tableAlias, Class entityClass, LockMode lockMode);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor addJoin(String tableAlias, String path);
|
||||
NativeQueryImplementor<T> addJoin(String tableAlias, String path);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor addJoin(String tableAlias, String ownerTableAlias, String joinPropertyName);
|
||||
NativeQueryImplementor<T> addJoin(String tableAlias, String ownerTableAlias, String joinPropertyName);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor addJoin(String tableAlias, String path, LockMode lockMode);
|
||||
NativeQueryImplementor<T> addJoin(String tableAlias, String path, LockMode lockMode);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setHibernateFlushMode(FlushMode flushMode);
|
||||
NativeQueryImplementor<T> setHibernateFlushMode(FlushMode flushMode);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setCacheMode(CacheMode cacheMode);
|
||||
NativeQueryImplementor<T> setCacheMode(CacheMode cacheMode);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setCacheable(boolean cacheable);
|
||||
NativeQueryImplementor<T> setCacheable(boolean cacheable);
|
||||
|
||||
@Override
|
||||
NativeQuery setCacheRegion(String cacheRegion);
|
||||
NativeQueryImplementor<T> setCacheRegion(String cacheRegion);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setTimeout(int timeout);
|
||||
NativeQueryImplementor<T> setTimeout(int timeout);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setFetchSize(int fetchSize);
|
||||
NativeQueryImplementor<T> setFetchSize(int fetchSize);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setReadOnly(boolean readOnly);
|
||||
NativeQueryImplementor<T> setReadOnly(boolean readOnly);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setLockOptions(LockOptions lockOptions);
|
||||
NativeQueryImplementor<T> setLockOptions(LockOptions lockOptions);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setLockMode(String alias, LockMode lockMode);
|
||||
NativeQueryImplementor<T> setLockMode(String alias, LockMode lockMode);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setComment(String comment);
|
||||
NativeQueryImplementor<T> setComment(String comment);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor addQueryHint(String hint);
|
||||
NativeQueryImplementor<T> addQueryHint(String hint);
|
||||
|
||||
@Override
|
||||
<T> NativeQueryImplementor setParameter(QueryParameter<T> parameter, T val);
|
||||
<P> NativeQueryImplementor<T> setParameter(QueryParameter<P> parameter, P val);
|
||||
|
||||
@Override
|
||||
<T> NativeQueryImplementor setParameter(Parameter<T> param, T value);
|
||||
<P> NativeQueryImplementor<T> setParameter(Parameter<P> param, P value);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setParameter(String name, Object val);
|
||||
NativeQueryImplementor<T> setParameter(String name, Object val);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor setParameter(QueryParameter<P> parameter, P val, Type type);
|
||||
<P> NativeQueryImplementor<T> setParameter(QueryParameter<P> parameter, P val, Type type);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setParameter(int position, Object val);
|
||||
NativeQueryImplementor<T> setParameter(int position, Object val);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setParameter(String name, Object val, Type type);
|
||||
NativeQueryImplementor<T> setParameter(String name, Object val, Type type);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setParameter(int position, Object val, Type type);
|
||||
NativeQueryImplementor<T> setParameter(int position, Object val, Type type);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor setParameter(QueryParameter<P> parameter, P val, TemporalType temporalType);
|
||||
<P> NativeQueryImplementor<T> setParameter(QueryParameter<P> parameter, P val, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setParameter(String name, Object val, TemporalType temporalType);
|
||||
NativeQueryImplementor<T> setParameter(String name, Object val, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setParameter(int position, Object val, TemporalType temporalType);
|
||||
NativeQueryImplementor<T> setParameter(int position, Object val, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor setParameterList(QueryParameter<P> parameter, Collection<P> values);
|
||||
<P> NativeQueryImplementor<T> setParameterList(QueryParameter<P> parameter, Collection<P> values);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setParameterList(String name, Collection values);
|
||||
NativeQueryImplementor<T> setParameterList(String name, Collection values);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setParameterList(String name, Collection values, Type type);
|
||||
NativeQueryImplementor<T> setParameterList(String name, Collection values, Type type);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setParameterList(String name, Object[] values, Type type);
|
||||
NativeQueryImplementor<T> setParameterList(String name, Object[] values, Type type);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setParameterList(String name, Object[] values);
|
||||
NativeQueryImplementor<T> setParameterList(String name, Object[] values);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setProperties(Object bean);
|
||||
NativeQueryImplementor<T> setProperties(Object bean);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setProperties(Map bean);
|
||||
NativeQueryImplementor<T> setProperties(Map bean);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setParameter(Parameter<Date> param, Date value, TemporalType temporalType);
|
||||
NativeQueryImplementor<T> setParameter(Parameter<Date> param, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType);
|
||||
NativeQueryImplementor<T> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setParameter(String name, Date value, TemporalType temporalType);
|
||||
NativeQueryImplementor<T> setParameter(String name, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setParameter(String name, Calendar value, TemporalType temporalType);
|
||||
NativeQueryImplementor<T> setParameter(String name, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setParameter(int position, Calendar value, TemporalType temporalType);
|
||||
NativeQueryImplementor<T> setParameter(int position, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setParameter(int position, Date value, TemporalType temporalType);
|
||||
NativeQueryImplementor<T> setParameter(int position, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor addSynchronizedQuerySpace(String querySpace);
|
||||
NativeQueryImplementor<T> addSynchronizedQuerySpace(String querySpace);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor addSynchronizedEntityName(String entityName) throws MappingException;
|
||||
NativeQueryImplementor<T> addSynchronizedEntityName(String entityName) throws MappingException;
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor setFlushMode(FlushMode flushMode);
|
||||
NativeQueryImplementor<T> setFlushMode(FlushMode flushMode);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor addSynchronizedEntityClass(Class entityClass) throws MappingException;
|
||||
NativeQueryImplementor<T> addSynchronizedEntityClass(Class entityClass) throws MappingException;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue