Package org.oddjob.sql
Class SQLPersisterService
java.lang.Object
org.oddjob.sql.SQLPersisterService
- Author:
- Rob Gordon.
Description
Persists job state to a database. The database must have a table which can be created with the following sql.
CREATE TABLE oddjob(
path VARCHAR(128),
id VARCHAR(32),
job BLOB,
CONSTRAINT oddjob_pk PRIMARY KEY (path, id))
Example
Using a SQL Persister.
<oddjob id="this">
<job>
<sequential>
<jobs>
<sql-persister-service id="sql-persister">
<connection>
<connection driver="org.hsqldb.jdbcDriver" url="jdbc:hsqldb:mem:test" username="sa"/>
</connection>
</sql-persister-service>
<oddjob id="oj" file="${this.dir}/SQLPersisterInner.xml">
<persister>
<value value="${sql-persister.persister(test)}"/>
</persister>
</oddjob>
<stop job="${sql-persister}"/>
</jobs>
</sequential>
</job>
</oddjob>
Note that because this is a service, it must be stopped once the inner Oddjob
has completed it's work. In an Oddjob that was running continually this would
not be necessary.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()getPersister(String path) voidsetConnection(Connection connection) Set the connection.voidvoidsetSerializationFactory(SQLSerializationFactory serializationFactory) voidstart()voidstop()toString()
-
Constructor Details
-
SQLPersisterService
public SQLPersisterService()
-
-
Method Details
-
start
- Throws:
SQLException
-
stop
- Throws:
SQLException
-
setConnection
Set the connection.- Parameters:
connection- The connection.- Throws:
SQLException
-
getName
-
setName
-
getSerializationFactory
-
setSerializationFactory
-
getPersister
- Reference Property:
- persister
- Required:
- R/O.
Description
The persister. -
toString
-