|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.axonframework.eventstore.jpa.SQLErrorCodesResolver
public class SQLErrorCodesResolver
SQLErrorCodesResolver is an implementation of PersistenceExceptionResolver used to resolve sql error codes to see if it is an duplicate key constraint violation.
SQL Code configuration is available for the following database engines, which may be identifier automatically via the data source:
| Constructor Summary | |
|---|---|
SQLErrorCodesResolver(DataSource dataSource)
Initialize a SQLErrorCodesResolver, automatically detecting the database name through the given dataSource. |
|
SQLErrorCodesResolver(List<Integer> duplicateKeyCodes)
Initializes the SQLErrorCodesResolver using the given list of SQL Codes representing Key Constraint Violations. |
|
SQLErrorCodesResolver(Properties properties,
DataSource dataSource)
Initialize the SQLErrorCodesResolver with the given properties and use the dataSource
to automatically retrieve the database product name. |
|
SQLErrorCodesResolver(Properties properties,
String databaseProductName)
Initialize a SQLErrorCodesResolver, automatically detecting the database name through the given dataSource. |
|
SQLErrorCodesResolver(String databaseProductName)
Initialize a SQLErrorCodesResolver, automatically detecting the database name through the given dataSource. |
|
| Method Summary | |
|---|---|
boolean |
isDuplicateKeyViolation(Exception exception)
Indicates whether the given exception represents a duplicate key violation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SQLErrorCodesResolver(List<Integer> duplicateKeyCodes)
duplicateKeyCodes - A list of Integer containing SQL Codes representing Key Constraint Violations
public SQLErrorCodesResolver(DataSource dataSource)
throws SQLException
dataSource - The data source providing the information about the backing database.
SQLException - when retrieving the database product name fails
AxonConfigurationException - is the dataSource returns an unknown database product name. Use SQLErrorCodesResolver(java.util.Properties, javax.sql.DataSource) instead.public SQLErrorCodesResolver(String databaseProductName)
databaseProductName - The product name of the database
AxonConfigurationException - is the dataSource returns an unknown database product name. Use SQLErrorCodesResolver(java.util.Properties, String) instead.
public SQLErrorCodesResolver(Properties properties,
String databaseProductName)
databaseName.duplicateKeyCodes=keyCode[,keyCode]*databaseName is the database product name as returned by the driver, with spaces ('
') replaced by underscore ('_'). The key codes must be a comma separated list of SQL Error code numbers (int).
properties - the properties defining SQL Error Codes for Duplicate Key violations for different
databasesdatabaseProductName - The product name of the database
public SQLErrorCodesResolver(Properties properties,
DataSource dataSource)
throws SQLException
properties and use the dataSource
to automatically retrieve the database product name.
The form of the properties is expected to be:databaseName.duplicateKeyCodes=keyCode[,keyCode]*databaseName is the database product name as returned by the driver, with spaces ('
') replaced by underscore ('_'). The key codes must be a comma separated list of SQL Error code numbers (int).
properties - the properties defining SQL Error Codes for Duplicate Key violations for different databasesdataSource - The data source providing the database product name
SQLException - when retrieving the database product name fails| Method Detail |
|---|
public boolean isDuplicateKeyViolation(Exception exception)
PersistenceExceptionResolverexception represents a duplicate key violation. Typically, duplicate key
violations indicates concurrent access to an entity in the application. Two users might be accessing the same
Aggregate, for example.
isDuplicateKeyViolation in interface PersistenceExceptionResolverexception - The exception to evaluate
true if the given exception represents a Duplicate Key Violation, false
otherwise.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||