use of org.hibernate.jpa.spi.NativeQueryTupleTransformer in project hibernate-orm by hibernate.
the class AbstractSharedSessionContract method createNativeQuery.
@SuppressWarnings({ "WeakerAccess", "unchecked" })
protected <T> NativeQueryImplementor createNativeQuery(NamedSQLQueryDefinition queryDefinition, Class<T> resultType) {
if (resultType != null && !Tuple.class.equals(resultType)) {
resultClassChecking(resultType, queryDefinition);
}
final NativeQueryImpl query = new NativeQueryImpl(queryDefinition, this, factory.getQueryPlanCache().getSQLParameterMetadata(queryDefinition.getQueryString(), false));
if (Tuple.class.equals(resultType)) {
query.setResultTransformer(new NativeQueryTupleTransformer());
}
query.setHibernateFlushMode(queryDefinition.getFlushMode());
query.setComment(queryDefinition.getComment() != null ? queryDefinition.getComment() : queryDefinition.getName());
if (queryDefinition.getLockOptions() != null) {
query.setLockOptions(queryDefinition.getLockOptions());
}
initQueryFromNamedDefinition(query, queryDefinition);
applyQuerySettingsAndHints(query);
return query;
}
use of org.hibernate.jpa.spi.NativeQueryTupleTransformer in project hibernate-reactive by hibernate.
the class ReactiveSessionImpl method createReactiveNativeQuery.
private <T> ReactiveNativeQuery<T> createReactiveNativeQuery(NamedSQLQueryDefinition queryDefinition, Class<T> resultType) {
if (resultType != null && !Tuple.class.equals(resultType) && !Object[].class.equals(resultType)) {
resultClassChecking(resultType, queryDefinition);
}
ReactiveNativeQueryImpl<T> query = new ReactiveNativeQueryImpl<>(queryDefinition, this, getFactory().getQueryPlanCache().getSQLParameterMetadata(queryDefinition.getQueryString(), false));
if (Tuple.class.equals(resultType)) {
query.setResultTransformer(new NativeQueryTupleTransformer());
}
applyQuerySettingsAndHints(query);
query.setHibernateFlushMode(queryDefinition.getFlushMode());
query.setComment(comment(queryDefinition));
if (queryDefinition.getLockOptions() != null) {
query.setLockOptions(queryDefinition.getLockOptions());
}
initQueryFromNamedDefinition(query, queryDefinition);
return query;
}
use of org.hibernate.jpa.spi.NativeQueryTupleTransformer in project hibernate-reactive by hibernate.
the class ReactiveStatelessSessionImpl method createReactiveNativeQuery.
// TODO fix nasty copy/paste
private <T> ReactiveNativeQuery<T> createReactiveNativeQuery(NamedSQLQueryDefinition queryDefinition, Class<T> resultType) {
if (resultType != null && !Tuple.class.equals(resultType) && !Object[].class.equals(resultType)) {
resultClassChecking(resultType, queryDefinition);
}
ReactiveNativeQueryImpl<T> query = new ReactiveNativeQueryImpl<>(queryDefinition, this, getFactory().getQueryPlanCache().getSQLParameterMetadata(queryDefinition.getQueryString(), false));
if (Tuple.class.equals(resultType)) {
query.setResultTransformer(new NativeQueryTupleTransformer());
}
applyQuerySettingsAndHints(query);
query.setHibernateFlushMode(queryDefinition.getFlushMode());
query.setComment(comment(queryDefinition));
if (queryDefinition.getLockOptions() != null) {
query.setLockOptions(queryDefinition.getLockOptions());
}
initQueryFromNamedDefinition(query, queryDefinition);
return query;
}
Aggregations