Package org.apache.velocity.runtime.resource.loader

# Class DefaultDatabaseObjectsFactory

java.lang.Object
org.apache.velocity.runtime.resource.loader.DefaultDatabaseObjectsFactory

All Implemented Interfaces:
  `DatabaseObjectsFactory`

public class DefaultDatabaseObjectsFactory extends Object implements DatabaseObjectsFactory
Database objects factory which will obtain a new connection from the data source and prepare needed statements at each call

## Constructor Summary

Constructors
Constructor
Description
`DefaultDatabaseObjectsFactory()`

## Method Summary

Modifier and Type
Method
Description
`void`
`init(DataSource dataSource, ExtProperties properties)`
Initialize the factory with the DataSourceResourceLoader properties
`PreparedStatement`
`prepareStatement(String sql)`
Prepare a statement
`void`
`releaseStatement(String sql, PreparedStatement stmt)`
Releases a prepared statement

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.velocity.runtime.resource.loader.DatabaseObjectsFactory

`clear, setLogger`

## Constructor Details

### DefaultDatabaseObjectsFactory

public DefaultDatabaseObjectsFactory()

## Method Details

### init

public void init(DataSource dataSource, ExtProperties properties)
Initialize the factory with the DataSourceResourceLoader properties

Specified by:
  `init` in interface `DatabaseObjectsFactory`
Parameters:
  `dataSource` - data source

### prepareStatement

public PreparedStatement prepareStatement(String sql) throws SQLException
Prepare a statement

Specified by:
  `prepareStatement` in interface `DatabaseObjectsFactory`
Parameters:
  `sql` - Statement SQL
Returns:
  prepared statement
Throws:
  `SQLException`

### releaseStatement

public void releaseStatement(String sql, PreparedStatement stmt) throws SQLException
Releases a prepared statement

Specified by:
  `releaseStatement` in interface `DatabaseObjectsFactory`
Parameters:
  `sql` - original sql query
  `stmt` - statement
Throws:
  `SQLException`