@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, waitexecuteDelete, getEntityprotected 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)
RepositoryOperationsgetQueryHints in interface RepositoryOperationsstoredQuery - The stored query@Nullable
public <T> T findOne(@NonNull
java.lang.Class<T> type,
@NonNull
java.io.Serializable id)
RepositoryOperationsfindOne in interface RepositoryOperationsT - The generic typetype - The typeid - The id@Nullable
public <T,R> R findOne(@NonNull
PreparedQuery<T,R> preparedQuery)
RepositoryOperationsfindOne in interface RepositoryOperationsT - The generic resultTypeR - The result typepreparedQuery - The prepared querypublic <T,R> boolean exists(@NonNull
PreparedQuery<T,R> preparedQuery)
RepositoryOperationsexists in interface RepositoryOperationsT - The generic resultTypeR - The result typepreparedQuery - The prepared query@NonNull
public <T> java.lang.Iterable<T> findAll(@NonNull
PagedQuery<T> query)
RepositoryOperationsfindAll in interface RepositoryOperationsT - The generic typequery - The root entitypublic <T> long count(PagedQuery<T> pagedQuery)
RepositoryOperationscount in interface RepositoryOperationsT - The generic typepagedQuery - The paged query@NonNull
public <T,R> java.lang.Iterable<R> findAll(@NonNull
PreparedQuery<T,R> preparedQuery)
RepositoryOperationsfindAll in interface RepositoryOperationsT - The entity typeR - The result typepreparedQuery - The prepared querypublic <T> T persist(@NonNull
InsertOperation<T> operation)
RepositoryOperationspersist in interface RepositoryOperationsT - The generic typeoperation - The operation@NonNull
public <T> T update(@NonNull
UpdateOperation<T> operation)
RepositoryOperationsupdate in interface RepositoryOperationsT - The generic typeoperation - The operation@NonNull
public <T> java.lang.Iterable<T> persistAll(@NonNull
BatchOperation<T> operation)
RepositoryOperationspersistAll in interface RepositoryOperationsT - The generic typeoperation - The operation@NonNull
public java.util.Optional<java.lang.Number> executeUpdate(@NonNull
PreparedQuery<?,java.lang.Number> preparedQuery)
RepositoryOperationsexecuteUpdate in interface RepositoryOperationspreparedQuery - The prepared querypublic <T> java.util.Optional<java.lang.Number> deleteAll(@NonNull
BatchOperation<T> operation)
RepositoryOperationsdeleteAll in interface RepositoryOperationsT - The generic typeoperation - The operation@NonNull
public <T,R> java.util.stream.Stream<R> findStream(@NonNull
PreparedQuery<T,R> preparedQuery)
RepositoryOperationsfindStream in interface RepositoryOperationsT - The entity typeR - The result typepreparedQuery - The prepared query@NonNull
public <T> java.util.stream.Stream<T> findStream(@NonNull
PagedQuery<T> pagedQuery)
RepositoryOperationsfindStream in interface RepositoryOperationsT - The generic typepagedQuery - The querypublic <R> Page<R> findPage(@NonNull PagedQuery<R> query)
RepositoryOperationsfindPage in interface RepositoryOperationsR - 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 JpaRepositoryOperationspublic void flush()
JpaRepositoryOperationsflush in interface JpaRepositoryOperations