|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.dao.support.DataAccessUtils
public abstract class DataAccessUtils
Miscellaneous utility methods for DAO implementations. Useful with any data access technology.
| Constructor Summary | |
|---|---|
DataAccessUtils()
|
|
| Method Summary | |
|---|---|
static int |
intResult(java.util.Collection results)
Return a unique int result from the given Collection. |
static long |
longResult(java.util.Collection results)
Return a unique long result from the given Collection. |
static java.lang.Object |
objectResult(java.util.Collection results,
java.lang.Class requiredType)
Return a unique result object from the given Collection. |
static java.lang.Object |
requiredSingleResult(java.util.Collection results)
Return a single result object from the given Collection. |
static java.lang.Object |
requiredUniqueResult(java.util.Collection results)
Return a unique result object from the given Collection. |
static java.lang.Object |
singleResult(java.util.Collection results)
Return a single result object from the given Collection. |
static java.lang.RuntimeException |
translateIfNecessary(java.lang.RuntimeException rawException,
PersistenceExceptionTranslator pet)
Return a translated exception if this is appropriate, otherwise return the input exception. |
static java.lang.Object |
uniqueResult(java.util.Collection results)
Return a unique result object from the given Collection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DataAccessUtils()
| Method Detail |
|---|
public static java.lang.Object singleResult(java.util.Collection results)
throws IncorrectResultSizeDataAccessException
Returns null if 0 result objects found;
throws an exception if more than 1 element found.
results - the result Collection (can be null)
null if none
IncorrectResultSizeDataAccessException - if more than one
element has been found in the given Collection
public static java.lang.Object requiredSingleResult(java.util.Collection results)
throws IncorrectResultSizeDataAccessException
Throws an exception if 0 or more than 1 element found.
results - the result Collection (can be null)
IncorrectResultSizeDataAccessException - if more than one
element has been found in the given Collection
EmptyResultDataAccessException - if no element at all
has been found in the given Collection
public static java.lang.Object uniqueResult(java.util.Collection results)
throws IncorrectResultSizeDataAccessException
Returns null if 0 result objects found;
throws an exception if more than 1 instance found.
results - the result Collection (can be null)
null if none
IncorrectResultSizeDataAccessException - if more than one
result object has been found in the given CollectionCollectionUtils.hasUniqueObject(java.util.Collection)
public static java.lang.Object requiredUniqueResult(java.util.Collection results)
throws IncorrectResultSizeDataAccessException
Throws an exception if 0 or more than 1 instance found.
results - the result Collection (can be null)
IncorrectResultSizeDataAccessException - if more than one
result object has been found in the given Collection
EmptyResultDataAccessException - if no result object at all
has been found in the given CollectionCollectionUtils.hasUniqueObject(java.util.Collection)
public static java.lang.Object objectResult(java.util.Collection results,
java.lang.Class requiredType)
throws IncorrectResultSizeDataAccessException,
TypeMismatchDataAccessException
results - the result Collection (can be null)
IncorrectResultSizeDataAccessException - if more than one
result object has been found in the given Collection
EmptyResultDataAccessException - if no result object
at all has been found in the given Collection
TypeMismatchDataAccessException - if the unique object does
not match the specified required type
public static int intResult(java.util.Collection results)
throws IncorrectResultSizeDataAccessException,
TypeMismatchDataAccessException
results - the result Collection (can be null)
IncorrectResultSizeDataAccessException - if more than one
result object has been found in the given Collection
EmptyResultDataAccessException - if no result object
at all has been found in the given Collection
TypeMismatchDataAccessException - if the unique object
in the collection is not convertable to an int
public static long longResult(java.util.Collection results)
throws IncorrectResultSizeDataAccessException,
TypeMismatchDataAccessException
results - the result Collection (can be null)
IncorrectResultSizeDataAccessException - if more than one
result object has been found in the given Collection
EmptyResultDataAccessException - if no result object
at all has been found in the given Collection
TypeMismatchDataAccessException - if the unique object
in the collection is not convertable to a long
public static java.lang.RuntimeException translateIfNecessary(java.lang.RuntimeException rawException,
PersistenceExceptionTranslator pet)
rawException - exception we may wish to translatepet - PersistenceExceptionTranslator to use to perform the translation
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||