Interface SagaSqlSchema
- All Known Implementing Classes:
GenericSagaSqlSchema,HsqlSagaSqlSchema,Oracle11SagaSqlSchema,PostgresSagaSqlSchema
public interface SagaSqlSchema
Interface describing the SQL statements that the JdbcSagaRepository needs to execute against the underlying
database.
- Since:
- 2.2
- Author:
- Kristian Rosenvold, Allard Buijze
-
Method Summary
Modifier and TypeMethodDescriptionreadAssociationValues(ResultSet resultSet) Reads a Set of AssociationValues from the givenresultSet, which has been returned by executing the Statement returned fromsql_findAssociations(Connection, String, String).readSerializedSaga(ResultSet resultSet) Reads a SerializedObject from the givenresultSet, which has been returned by executing the Statement returned fromsql_loadSaga(java.sql.Connection, String)Reads a token from the givenresultSet.sql_createTableAssocValueEntry(Connection connection) Creates a PreparedStatement that creates the table for storing Association Values for Sagas.sql_createTableSagaEntry(Connection connection) Creates a PreparedStatement that creates the table for storing Sagas.sql_deleteAssociationEntries(Connection connection, String sagaIdentifier) Creates a PreparedStatement that deletes all association entries for a Saga with givensagaIdentifier.sql_deleteSagaEntry(Connection connection, String sagaIdentifier) Creates a PreparedStatement that deletes a Saga with givensagaIdentifier.sql_findAssociations(Connection connection, String sagaIdentifier, String sagaType) Creates a PreparedStatement that finds the associations of a Saga of givensagaTypeand givensagaIdentifier.sql_findAssocSagaIdentifiers(Connection connection, String key, String value, String sagaType) Creates a PreparedStatement that finds identifiers of Sagas of givensagaTypeassociated with the given associationkeyandvalue.sql_loadSaga(Connection connection, String sagaId) Creates a PreparedStatement that loads a single Saga, with givensagaId.sql_removeAssocValue(Connection connection, String key, String value, String sagaType, String sagaIdentifier) Creates a PreparedStatement that removes an association value for givensagaIdentifier, where the association is identified with givenkeyandvalue.sql_storeAssocValue(Connection connection, String key, String value, String sagaType, String sagaIdentifier) Creates a PreparedStatement that stores an association with givenkeyandvalue, for a Saga of giventypeandidentifier.sql_storeSaga(Connection connection, String sagaIdentifier, String revision, String sagaType, byte[] serializedSaga) Creates a PreparedStatement that inserts a Saga entry, of givensagaTypeand with givensagaIdentifier.sql_updateSaga(Connection connection, String sagaIdentifier, byte[] serializedSaga, String sagaType, String revision) Creates a PreparedStatement that updates the serialized form of an existing Saga entry, of givensagaTypeand with givensagaIdentifier.
-
Method Details
-
sql_loadSaga
Creates a PreparedStatement that loads a single Saga, with givensagaId.- Parameters:
connection- The connection to create the PreparedStatement forsagaId- The identifier of the Saga to return- Returns:
- a statement, that creates a result set to be processed by
readSerializedSaga(java.sql.ResultSet), when executed - Throws:
SQLException- when an error occurs creating the PreparedStatement
-
sql_removeAssocValue
PreparedStatement sql_removeAssocValue(Connection connection, String key, String value, String sagaType, String sagaIdentifier) throws SQLException Creates a PreparedStatement that removes an association value for givensagaIdentifier, where the association is identified with givenkeyandvalue.- Parameters:
connection- The connection to create the PreparedStatement forkey- The key of the association to removevalue- The value of the association to removesagaType- The type of saga to remove the association forsagaIdentifier- The identifier of the Saga to remove the association for- Returns:
- a statement that removes the association value, when executed
- Throws:
SQLException- when an error occurs creating the PreparedStatement
-
sql_storeAssocValue
PreparedStatement sql_storeAssocValue(Connection connection, String key, String value, String sagaType, String sagaIdentifier) throws SQLException Creates a PreparedStatement that stores an association with givenkeyandvalue, for a Saga of giventypeandidentifier.- Parameters:
connection- The connection to create the PreparedStatement forkey- The key of the association to storevalue- The value of the association to storesagaType- The type of saga to create the association forsagaIdentifier- The identifier of the Saga to create the association for- Returns:
- a statement that inserts the association value, when executed
- Throws:
SQLException- when an error occurs creating the PreparedStatement
-
sql_findAssocSagaIdentifiers
PreparedStatement sql_findAssocSagaIdentifiers(Connection connection, String key, String value, String sagaType) throws SQLException Creates a PreparedStatement that finds identifiers of Sagas of givensagaTypeassociated with the given associationkeyandvalue.- Parameters:
connection- The connection to create the PreparedStatement forkey- The key of the associationvalue- The value of the associationsagaType- The type of saga to find associations for- Returns:
- a PreparedStatement that creates a ResultSet containing only saga identifiers when executed
- Throws:
SQLException- when an error occurs creating the PreparedStatement
-
sql_findAssociations
PreparedStatement sql_findAssociations(Connection connection, String sagaIdentifier, String sagaType) throws SQLException Creates a PreparedStatement that finds the associations of a Saga of givensagaTypeand givensagaIdentifier.- Parameters:
connection- The connection to create the PreparedStatement forsagaIdentifier- The identifier of the SagasagaType- The type of saga to find associations for- Returns:
- a PreparedStatement that creates a ResultSet containing association keys and their values
- Throws:
SQLException- when an error occurs while creating the PreparedStatement
-
sql_deleteSagaEntry
PreparedStatement sql_deleteSagaEntry(Connection connection, String sagaIdentifier) throws SQLException Creates a PreparedStatement that deletes a Saga with givensagaIdentifier.- Parameters:
connection- The connection to create the PreparedStatement forsagaIdentifier- The identifier of the Saga to remove- Returns:
- a statement that deletes the Saga, when executed
- Throws:
SQLException- when an error occurs creating the PreparedStatement
-
sql_deleteAssociationEntries
PreparedStatement sql_deleteAssociationEntries(Connection connection, String sagaIdentifier) throws SQLException Creates a PreparedStatement that deletes all association entries for a Saga with givensagaIdentifier.- Parameters:
connection- The connection to create the PreparedStatement forsagaIdentifier- The identifier of the Saga to remove associations for- Returns:
- a statement that deletes the associations, when executed
- Throws:
SQLException- when an error occurs creating the PreparedStatement
-
sql_updateSaga
PreparedStatement sql_updateSaga(Connection connection, String sagaIdentifier, byte[] serializedSaga, String sagaType, String revision) throws SQLException Creates a PreparedStatement that updates the serialized form of an existing Saga entry, of givensagaTypeand with givensagaIdentifier.- Parameters:
connection- The connection to create the PreparedStatement forsagaIdentifier- The identifier of the Saga to updateserializedSaga- The serialized form of the saga to updatesagaType- The serialized type of the sagarevision- The revision identifier of the serialized form- Returns:
- a statement that updates a Saga entry, when executed
- Throws:
SQLException- when an error occurs creating the PreparedStatement
-
sql_storeSaga
PreparedStatement sql_storeSaga(Connection connection, String sagaIdentifier, String revision, String sagaType, byte[] serializedSaga) throws SQLException Creates a PreparedStatement that inserts a Saga entry, of givensagaTypeand with givensagaIdentifier.- Parameters:
connection- The connection to create the PreparedStatement forsagaIdentifier- The identifier of the Saga to insertrevision- The revision identifier of the serialized formsagaType- The serialized type of the sagaserializedSaga- The serialized form of the saga to insert- Returns:
- a statement that inserts a Saga entry, when executed
- Throws:
SQLException- when an error occurs creating the PreparedStatement
-
sql_createTableAssocValueEntry
Creates a PreparedStatement that creates the table for storing Association Values for Sagas.- Parameters:
connection- The connection to create the PreparedStatement for- Returns:
- a Prepared statement that created the Association Value table, when executed
- Throws:
SQLException- when an error occurs creating the PreparedStatement
-
sql_createTableSagaEntry
Creates a PreparedStatement that creates the table for storing Sagas.- Parameters:
connection- The connection to create the PreparedStatement for- Returns:
- a Prepared statement that created the Saga table, when executed
- Throws:
SQLException- when an error occurs creating the PreparedStatement
-
readSerializedSaga
Reads a SerializedObject from the givenresultSet, which has been returned by executing the Statement returned fromsql_loadSaga(java.sql.Connection, String)Note: The implementation must not change the resultSet's cursor position- Parameters:
resultSet- The result set to read data from.- Returns:
- a SerializedObject, containing the serialized data from the resultSet
- Throws:
SQLException- when an exception occurs reading from the resultSet
-
readAssociationValues
Reads a Set of AssociationValues from the givenresultSet, which has been returned by executing the Statement returned fromsql_findAssociations(Connection, String, String).- Parameters:
resultSet- The result set to read data from.- Returns:
- a Set of AssociationValues from the resultSet
- Throws:
SQLException- when an exception occurs reading from the resultSet
-
readToken
Reads a token from the givenresultSet.- Parameters:
resultSet- The result set to read data from.- Returns:
- the token from the resultSet
- Throws:
SQLException- when an exception occurs reading from the resultSet
-