HHH-11962 Unmark deprecated the NativeQuery methods

This commit is contained in:
Guillaume Smet 2017-09-01 11:31:26 +02:00 committed by Vlad Mihalcea
parent 97bc632236
commit 02c5996571
2 changed files with 216 additions and 0 deletions

View File

@ -6,14 +6,24 @@
*/
package org.hibernate.query;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZonedDateTime;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Map;
import javax.persistence.FlushModeType;
import javax.persistence.LockModeType;
import javax.persistence.Parameter;
import javax.persistence.TemporalType;
import org.hibernate.CacheMode;
import org.hibernate.FlushMode;
import org.hibernate.LockMode;
import org.hibernate.LockOptions;
import org.hibernate.MappingException;
import org.hibernate.SQLQuery;
import org.hibernate.SynchronizeableQuery;
@ -23,6 +33,7 @@ import org.hibernate.type.Type;
* @author Steve Ebersole
*/
public interface NativeQuery<T> extends Query<T>, SQLQuery<T>, SynchronizeableQuery<T> {
@Override
NativeQuery<T> setFlushMode(FlushMode flushMode);
@ -77,6 +88,42 @@ public interface NativeQuery<T> extends Query<T>, SQLQuery<T>, SynchronizeableQu
@Override
NativeQuery<T> setParameter(int position, Date value, TemporalType temporalType);
@Override
NativeQuery<T> setParameter(Parameter<Instant> param, Instant value, TemporalType temporalType);
@Override
NativeQuery<T> setParameter(Parameter<LocalDateTime> param, LocalDateTime value, TemporalType temporalType);
@Override
NativeQuery<T> setParameter(Parameter<ZonedDateTime> param, ZonedDateTime value, TemporalType temporalType);
@Override
NativeQuery<T> setParameter(Parameter<OffsetDateTime> param, OffsetDateTime value, TemporalType temporalType);
@Override
NativeQuery<T> setParameter(String name, Instant value, TemporalType temporalType);
@Override
NativeQuery<T> setParameter(String name, LocalDateTime value, TemporalType temporalType);
@Override
NativeQuery<T> setParameter(String name, ZonedDateTime value, TemporalType temporalType);
@Override
NativeQuery<T> setParameter(String name, OffsetDateTime value, TemporalType temporalType);
@Override
NativeQuery<T> setParameter(int position, Instant value, TemporalType temporalType);
@Override
NativeQuery<T> setParameter(int position, LocalDateTime value, TemporalType temporalType);
@Override
NativeQuery<T> setParameter(int position, ZonedDateTime value, TemporalType temporalType);
@Override
NativeQuery<T> setParameter(int position, OffsetDateTime value, TemporalType temporalType);
@Override
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, Collection<P> values);
@ -106,4 +153,97 @@ public interface NativeQuery<T> extends Query<T>, SQLQuery<T>, SynchronizeableQu
@Override
NativeQuery<T> addSynchronizedEntityClass(Class entityClass) throws MappingException;
@Override
boolean isCallable();
@Override
NativeQuery<T> addScalar(String columnAlias);
@Override
NativeQuery<T> addScalar(String columnAlias, Type type);
@Override
RootReturn addRoot(String tableAlias, String entityName);
@Override
RootReturn addRoot(String tableAlias, Class entityType);
@Override
NativeQuery<T> addEntity(String entityName);
@Override
NativeQuery<T> addEntity(String tableAlias, String entityName);
@Override
NativeQuery<T> addEntity(String tableAlias, String entityName, LockMode lockMode);
@Override
NativeQuery<T> addEntity(Class entityType);
@Override
NativeQuery<T> addEntity(String tableAlias, Class entityType);
@Override
NativeQuery<T> addEntity(String tableAlias, Class entityClass, LockMode lockMode);
@Override
FetchReturn addFetch(String tableAlias, String ownerTableAlias, String joinPropertyName);
@Override
NativeQuery<T> addJoin(String tableAlias, String path);
@Override
NativeQuery<T> addJoin(String tableAlias, String ownerTableAlias, String joinPropertyName);
@Override
NativeQuery<T> addJoin(String tableAlias, String path, LockMode lockMode);
@Override
NativeQuery<T> setHibernateFlushMode(FlushMode flushMode);
@Override
NativeQuery<T> setFlushMode(FlushModeType flushMode);
@Override
NativeQuery<T> setCacheMode(CacheMode cacheMode);
@Override
NativeQuery<T> setCacheable(boolean cacheable);
@Override
NativeQuery<T> setCacheRegion(String cacheRegion);
@Override
NativeQuery<T> setTimeout(int timeout);
@Override
NativeQuery<T> setFetchSize(int fetchSize);
@Override
NativeQuery<T> setReadOnly(boolean readOnly);
@Override
NativeQuery<T> setLockOptions(LockOptions lockOptions);
@Override
NativeQuery<T> setLockMode(String alias, LockMode lockMode);
@Override
NativeQuery<T> setComment(String comment);
@Override
NativeQuery<T> addQueryHint(String hint);
@Override
NativeQuery<T> setMaxResults(int maxResult);
@Override
NativeQuery<T> setFirstResult(int startPosition);
@Override
NativeQuery<T> setHint(String hintName, Object value);
@Override
NativeQuery<T> setLockMode(LockModeType lockMode);
}

View File

@ -7,6 +7,10 @@
package org.hibernate.query.internal;
import java.io.Serializable;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@ -626,6 +630,78 @@ public class NativeQueryImpl<T> extends AbstractProducedQuery<T> implements Nati
return this;
}
@Override
public NativeQueryImplementor<T> setParameter(Parameter<Instant> param, Instant value, TemporalType temporalType) {
super.setParameter( param, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor<T> setParameter(Parameter<LocalDateTime> param, LocalDateTime value, TemporalType temporalType) {
super.setParameter( param, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor<T> setParameter(Parameter<ZonedDateTime> param, ZonedDateTime value, TemporalType temporalType) {
super.setParameter( param, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor<T> setParameter(Parameter<OffsetDateTime> param, OffsetDateTime value, TemporalType temporalType) {
super.setParameter( param, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor<T> setParameter(String name, Instant value, TemporalType temporalType) {
super.setParameter( name, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor<T> setParameter(String name, LocalDateTime value, TemporalType temporalType) {
super.setParameter( name, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor<T> setParameter(String name, ZonedDateTime value, TemporalType temporalType) {
super.setParameter( name, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor<T> setParameter(String name, OffsetDateTime value, TemporalType temporalType) {
super.setParameter( name, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor<T> setParameter(int position, Instant value, TemporalType temporalType) {
super.setParameter( position, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor<T> setParameter(int position, LocalDateTime value, TemporalType temporalType) {
super.setParameter( position, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor<T> setParameter(int position, ZonedDateTime value, TemporalType temporalType) {
super.setParameter( position, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor<T> setParameter(int position, OffsetDateTime value, TemporalType temporalType) {
super.setParameter( position, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor<T> setParameterList(QueryParameter parameter, Collection values) {
super.setParameterList( parameter, values );