| |
|
| biz.hammurapi.transformica.TransformTask biz.hammurapi.transformica.jdbc.JdbcTask
JdbcTask | public class JdbcTask extends TransformTask (Code) | | Traverses rowset produced by query. Transformations are defined by nested channel elements.
Velocity template engine is used for code generation. Current row is accessible through 'element' context object.
Row's class is dynamically generated and has get<Field name> method for every field in a row.
Thus field NAME can be addressed in a template as ${element.name} instead of ${element.getString("NAME")} as if java.sql.ResultSet
were used.
'session' context object of type biz.hammurapi.transformica.TransformSession gives access to current Ant project and provides
methods to include other templates or channels and to store information.
<taskdef name="jdbctransform" classname="biz.hammurapi.transformica.jdbc.JdbcTask">
<classpath>
<fileset dir="lib" includes="*.jar"/>
</classpath>
</taskdef>
<jdbctransform
driver="org.hsqldb.jdbcDriver"
url="jdbc:hsqldb:hsql://localhost"
user="sa"
password=""
>
<query>SELECT * FROM MYTABLE</query>
<channel
outputDir="generated"
template="templates/jdbc.java"
fileNameTemplate='$${element.name}.java'
>
<filetouchdetector fileInfoFile="fileInfo.txt" genRoot="generated"/>
</channel>
</jdbctransform>
author: Pavel Vlasov |
createQuery | public QueryEntry createQuery() throws BuildException(Code) | | SQL query to execute
throws: BuildException - |
execute | public void execute() throws BuildException(Code) | | |
setDriver | public void setDriver(String driver)(Code) | | JDBC Driver class name
Parameters: driver - The driver to set. |
setPassword | public void setPassword(String password)(Code) | | Password
Parameters: password - The password to set. |
setURL | public void setURL(String url)(Code) | | Connection string
Parameters: url - The connectionString to set. |
setUser | public void setUser(String userName)(Code) | | User name
Parameters: userName - The userName to set. |
|
|
|