Spring Integration

org.springframework.integration.jpa.core
Interface JpaOperations

All Known Implementing Classes:
DefaultJpaOperations

public interface JpaOperations

The Interface containing all the JpaOperations those will be executed by the Jpa Spring Integration components.

Since:
2.2
Author:
Amol Nayak, Gunnar Hillert

Method Summary
 void delete(java.lang.Object entity)
           
 void deleteInBatch(java.lang.Iterable<?> entities)
           
 int executeUpdate(java.lang.String updateQuery, ParameterSource source)
          Executes the given update statement and uses the given parameter source to set the required query parameters.
 int executeUpdateWithNamedQuery(java.lang.String updateQuery, ParameterSource source)
           
 int executeUpdateWithNativeQuery(java.lang.String updateQuery, ParameterSource source)
           
<T> T
find(java.lang.Class<T> entityType, java.lang.Object id)
          Find an Entity of given type with the given primary key type.
 java.util.List<?> getResultListForClass(java.lang.Class<?> entityClass, int maxNumberOfReturnedObjects)
           
 java.util.List<?> getResultListForNamedQuery(java.lang.String selectNamedQuery, ParameterSource jpaQLParameterSource, int maxNumberOfResults)
           
 java.util.List<?> getResultListForNativeQuery(java.lang.String selectQuery, java.lang.Class<?> entityClass, ParameterSource jpaQLParameterSource, int maxNumberOfResults)
           
 java.util.List<?> getResultListForQuery(java.lang.String query, ParameterSource source)
          Executes the provided query to return a list of results
 java.util.List<?> getResultListForQuery(java.lang.String query, ParameterSource source, int maxNumberOfResults)
          Executes the provided query to return a list of results.
 java.lang.Object getSingleResultForQuery(java.lang.String query, ParameterSource source)
          Executes the provided query to return a single element
 java.lang.Object merge(java.lang.Object entity)
          The entity to be merged with the entity manager
 void persist(java.lang.Object entity)
          Persists the entity
 

Method Detail

delete

void delete(java.lang.Object entity)
Parameters:
entity -

deleteInBatch

void deleteInBatch(java.lang.Iterable<?> entities)
Parameters:
entities -

executeUpdate

int executeUpdate(java.lang.String updateQuery,
                  ParameterSource source)
Executes the given update statement and uses the given parameter source to set the required query parameters.

Parameters:
updateQuery - Must Not be empty.
source - Must Not be null.
Returns:
The number of entities updated

executeUpdateWithNamedQuery

int executeUpdateWithNamedQuery(java.lang.String updateQuery,
                                ParameterSource source)
Parameters:
updateQuery -
source -
Returns:
The number of entities updated

executeUpdateWithNativeQuery

int executeUpdateWithNativeQuery(java.lang.String updateQuery,
                                 ParameterSource source)
Parameters:
updateQuery -
source -
Returns:
The number of entities updated

find

<T> T find(java.lang.Class<T> entityType,
           java.lang.Object id)
Find an Entity of given type with the given primary key type.

Type Parameters:
T -
Parameters:
entityType -
id -
Returns:
The entity if it exist, null is returned otherwise

getResultListForClass

java.util.List<?> getResultListForClass(java.lang.Class<?> entityClass,
                                        int maxNumberOfReturnedObjects)
Parameters:
entityClass -
maxNumberOfReturnedObjects -
Returns:
List of found entities

getResultListForNamedQuery

java.util.List<?> getResultListForNamedQuery(java.lang.String selectNamedQuery,
                                             ParameterSource jpaQLParameterSource,
                                             int maxNumberOfResults)
Parameters:
selectNamedQuery -
jpaQLParameterSource -
maxNumberOfResults -
Returns:
List of found entities

getResultListForNativeQuery

java.util.List<?> getResultListForNativeQuery(java.lang.String selectQuery,
                                              java.lang.Class<?> entityClass,
                                              ParameterSource jpaQLParameterSource,
                                              int maxNumberOfResults)
Parameters:
selectQuery -
entityClass -
jpaQLParameterSource -
maxNumberOfResults -
Returns:
List of found entities

getResultListForQuery

java.util.List<?> getResultListForQuery(java.lang.String query,
                                        ParameterSource source)
Executes the provided query to return a list of results

Parameters:
query -
source - the Parameter source for this query to be executed, if none then set as null
Returns:
List of found entities

getResultListForQuery

java.util.List<?> getResultListForQuery(java.lang.String query,
                                        ParameterSource source,
                                        int maxNumberOfResults)
Executes the provided query to return a list of results.

Parameters:
query - Must not be null or empty
maxNumberOfResults - Must be a non-negative value
source - the Parameter source for this query to be executed, if none then set null
Returns:
List of found entities

getSingleResultForQuery

java.lang.Object getSingleResultForQuery(java.lang.String query,
                                         ParameterSource source)
Executes the provided query to return a single element

Parameters:
query - Must not be empty
source - the Parameter source for this query to be executed, if none then set as null
Returns:
Will always return a result. If no object was found in the database an exception is raised.

merge

java.lang.Object merge(java.lang.Object entity)
The entity to be merged with the entity manager

Parameters:
entity - Must not be null.
Returns:
The merged managed instance of the entity.

persist

void persist(java.lang.Object entity)
Persists the entity

Parameters:
entity - Must not be null

Spring Integration