@EachBean(value=org.hibernate.SessionFactory.class) public class HibernateJpaOperations extends java.lang.Object implements JpaRepositoryOperations, AsyncCapableRepository, ReactiveCapableRepository
JpaRepositoryOperations
interface for Hibernate.Modifier | Constructor and Description |
---|---|
protected |
HibernateJpaOperations(org.hibernate.SessionFactory sessionFactory,
TransactionOperations<java.sql.Connection> transactionOperations,
java.util.concurrent.ExecutorService executorService)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
ExecutorAsyncOperations |
async() |
<T> long |
count(PagedQuery<T> pagedQuery)
Counts all results for the given query.
|
<T> java.util.Optional<java.lang.Number> |
deleteAll(BatchOperation<T> operation)
Deletes all the entities of the given type.
|
java.util.Optional<java.lang.Number> |
executeUpdate(PreparedQuery<?,java.lang.Number> preparedQuery)
Executes an update for the given query and parameter values.
|
<T,R> boolean |
exists(PreparedQuery<T,R> preparedQuery)
Execute a query that checks for existence.
|
<T> java.lang.Iterable<T> |
findAll(PagedQuery<T> query)
Finds all results for the given query.
|
<T,R> java.lang.Iterable<R> |
findAll(PreparedQuery<T,R> preparedQuery)
Finds all results for the given query.
|
<T> T |
findOne(java.lang.Class<T> type,
java.io.Serializable id)
Find one by ID.
|
<T,R> R |
findOne(PreparedQuery<T,R> preparedQuery)
Find one by Query.
|
<R> Page<R> |
findPage(PagedQuery<R> query)
Find a page for the given entity and pageable.
|
<T> java.util.stream.Stream<T> |
findStream(PagedQuery<T> pagedQuery)
Finds a stream for the given arguments.
|
<T,R> java.util.stream.Stream<R> |
findStream(PreparedQuery<T,R> preparedQuery)
Finds all results for the given query.
|
void |
flush()
Flush the current session.
|
javax.persistence.EntityManager |
getCurrentEntityManager() |
javax.persistence.EntityManagerFactory |
getEntityManagerFactory() |
java.util.Map<java.lang.String,java.lang.Object> |
getQueryHints(StoredQuery<?,?> storedQuery)
Obtain any custom query hints for this method and repository implementation.
|
<T> T |
persist(InsertOperation<T> operation)
Persist the operation returning a possibly new entity.
|
<T> java.lang.Iterable<T> |
persistAll(BatchOperation<T> operation)
Persist all the given entities.
|
ReactiveRepositoryOperations |
reactive() |
<T> T |
update(UpdateOperation<T> operation)
Updates the entity for the given operation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
executeDelete, getEntity
protected HibernateJpaOperations(@NonNull org.hibernate.SessionFactory sessionFactory, @NonNull @Parameter TransactionOperations<java.sql.Connection> transactionOperations, @Named(value="io") @Nullable java.util.concurrent.ExecutorService executorService)
sessionFactory
- The session factorytransactionOperations
- The transaction operationsexecutorService
- The executor service for I/O tasks to use@NonNull public java.util.Map<java.lang.String,java.lang.Object> getQueryHints(@NonNull StoredQuery<?,?> storedQuery)
RepositoryOperations
getQueryHints
in interface RepositoryOperations
storedQuery
- The stored query@Nullable public <T> T findOne(@NonNull java.lang.Class<T> type, @NonNull java.io.Serializable id)
RepositoryOperations
findOne
in interface RepositoryOperations
T
- The generic typetype
- The typeid
- The id@Nullable public <T,R> R findOne(@NonNull PreparedQuery<T,R> preparedQuery)
RepositoryOperations
findOne
in interface RepositoryOperations
T
- The generic resultTypeR
- The result typepreparedQuery
- The prepared querypublic <T,R> boolean exists(@NonNull PreparedQuery<T,R> preparedQuery)
RepositoryOperations
exists
in interface RepositoryOperations
T
- The generic resultTypeR
- The result typepreparedQuery
- The prepared query@NonNull public <T> java.lang.Iterable<T> findAll(@NonNull PagedQuery<T> query)
RepositoryOperations
findAll
in interface RepositoryOperations
T
- The generic typequery
- The root entitypublic <T> long count(PagedQuery<T> pagedQuery)
RepositoryOperations
count
in interface RepositoryOperations
T
- The generic typepagedQuery
- The paged query@NonNull public <T,R> java.lang.Iterable<R> findAll(@NonNull PreparedQuery<T,R> preparedQuery)
RepositoryOperations
findAll
in interface RepositoryOperations
T
- The entity typeR
- The result typepreparedQuery
- The prepared querypublic <T> T persist(@NonNull InsertOperation<T> operation)
RepositoryOperations
persist
in interface RepositoryOperations
T
- The generic typeoperation
- The operation@NonNull public <T> T update(@NonNull UpdateOperation<T> operation)
RepositoryOperations
update
in interface RepositoryOperations
T
- The generic typeoperation
- The operation@NonNull public <T> java.lang.Iterable<T> persistAll(@NonNull BatchOperation<T> operation)
RepositoryOperations
persistAll
in interface RepositoryOperations
T
- The generic typeoperation
- The operation@NonNull public java.util.Optional<java.lang.Number> executeUpdate(@NonNull PreparedQuery<?,java.lang.Number> preparedQuery)
RepositoryOperations
executeUpdate
in interface RepositoryOperations
preparedQuery
- The prepared querypublic <T> java.util.Optional<java.lang.Number> deleteAll(@NonNull BatchOperation<T> operation)
RepositoryOperations
deleteAll
in interface RepositoryOperations
T
- The generic typeoperation
- The operation@NonNull public <T,R> java.util.stream.Stream<R> findStream(@NonNull PreparedQuery<T,R> preparedQuery)
RepositoryOperations
findStream
in interface RepositoryOperations
T
- The entity typeR
- The result typepreparedQuery
- The prepared query@NonNull public <T> java.util.stream.Stream<T> findStream(@NonNull PagedQuery<T> pagedQuery)
RepositoryOperations
findStream
in interface RepositoryOperations
T
- The generic typepagedQuery
- The querypublic <R> Page<R> findPage(@NonNull PagedQuery<R> query)
RepositoryOperations
findPage
in interface RepositoryOperations
R
- The entity generic typequery
- The query@NonNull public ExecutorAsyncOperations async()
async
in interface AsyncCapableRepository
@NonNull public ReactiveRepositoryOperations reactive()
reactive
in interface ReactiveCapableRepository
@NonNull public javax.persistence.EntityManager getCurrentEntityManager()
getCurrentEntityManager
in interface JpaRepositoryOperations
@NonNull public javax.persistence.EntityManagerFactory getEntityManagerFactory()
getEntityManagerFactory
in interface JpaRepositoryOperations
public void flush()
JpaRepositoryOperations
flush
in interface JpaRepositoryOperations