Helper class for converting a
into
the appropriate OpenJPA type.
| Method from org.apache.openjpa.jdbc.sql.SQLExceptions Detail: |
public static OpenJPAException getStore(SQLException se) {
return getStore(se, null, null);
}
|
public static OpenJPAException getStore(SQLException se,
Object failed) {
return getStore(se, failed, null);
}
|
public static OpenJPAException getStore(SQLException se,
DBDictionary dict) {
return getStore(se.getMessage(), se, dict);
}
|
public static OpenJPAException getStore(SQLException se,
Object failed,
DBDictionary dict) {
return getStore(se.getMessage(), se, failed, dict);
}
|
public static OpenJPAException getStore(Message msg,
SQLException se,
DBDictionary dict) {
return getStore(msg.getMessage(), se, null, dict);
}
|
public static OpenJPAException getStore(String msg,
SQLException se,
DBDictionary dict) {
return getStore(msg, se, null, dict);
}
|
public static OpenJPAException getStore(String msg,
SQLException se,
Object failed,
DBDictionary dict) {
if (msg == null)
msg = se.getClass().getName();
SQLException[] ses = getSQLExceptions(se);
if (dict == null)
return new StoreException(msg).setFailedObject(failed).
setNestedThrowables(ses);
return dict.newStoreException(msg, ses, failed);
}
|
public static OpenJPAException narrow(String msg,
SQLException se,
DBDictionary dict) {
String e = se.getSQLState();
if (dict.getSQLStates(StoreException.LOCK).contains(e))
return new LockException(msg);
else if (dict.getSQLStates(StoreException.OBJECT_EXISTS).contains(e))
return new ObjectExistsException(msg);
else if (dict.getSQLStates(StoreException.OBJECT_NOT_FOUND).contains(e))
return new ObjectNotFoundException(msg);
else if (dict.getSQLStates(StoreException.OPTIMISTIC).contains(e))
return new OptimisticException(msg);
else if (dict.getSQLStates(StoreException.REFERENTIAL_INTEGRITY)
.contains(e))
return new ReferentialIntegrityException(msg);
else
return new StoreException(msg);
}
Narrows the given SQLException to a specific type of
StoreException by analyzing the
SQLState code supplied by SQLException. Each database-specific
dictionary can supply a set of error codes that will
map to a specific specific type of StoreException via
getSQLStates() method.
The default behavior is to return generic StoreException . |