Package org.springframework.batch.item.database.orm

# Class HibernateNativeQueryProvider<E>

java.lang.Object
org.springframework.batch.item.database.orm.AbstractHibernateQueryProvider<E>
org.springframework.batch.item.database.orm.HibernateNativeQueryProvider<E>

Type Parameters:
  `E` - entity returned by executing the query

All Implemented Interfaces:
  `HibernateQueryProvider<E>`

public class HibernateNativeQueryProvider<E> extends AbstractHibernateQueryProvider<E>

This query provider creates Hibernate `Query`s from injected native SQL queries. This is useful if there is a need to utilize database-specific features such as query hints, the CONNECT keyword in Oracle, etc.

Author:
  Anatoly Polinsky

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `HibernateNativeQueryProvider()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `afterPropertiesSet()`
  `org.hibernate.query.NativeQuery<E>`
  `createQuery()`
  Create an `NativeQuery` from the session provided (preferring stateless if both are available).
  `void`
  `setEntityClass(Class<E> entityClazz)`
  `void`
  `setSqlQuery(String sqlQuery)`

  ### Methods inherited from class org.springframework.batch.item.database.orm.AbstractHibernateQueryProvider

  `getStatefulSession, getStatelessSession, isStatelessSession, setSession, setStatelessSession`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### HibernateNativeQueryProvider

    public HibernateNativeQueryProvider()

- ## Method Details

  - ### createQuery

    public org.hibernate.query.NativeQuery<E> createQuery()

    Create an `NativeQuery` from the session provided (preferring stateless if both are available).

    Returns:
      created query

  - ### setSqlQuery

    public void setSqlQuery(String sqlQuery)

  - ### setEntityClass

    public void setEntityClass(Class<E> entityClazz)

  - ### afterPropertiesSet

    public void afterPropertiesSet() throws Exception
    Throws:
      `Exception`