Package org.mybatis.generator.internal
Class JDBCConnectionFactory
java.lang.Object
org.mybatis.generator.internal.JDBCConnectionFactory
- All Implemented Interfaces:
ConnectionFactory
This class assumes that classes are cached elsewhere for performance reasons,
but also to make sure that any native libraries are only loaded one time.
This avoids the dreaded UnsatisfiedLinkError library loaded in another
classloader.
- Author:
- Jeff Butler
-
Constructor Summary
ConstructorDescriptionThis constructor is called when this connection factory is specified as the type in a ConnectionFactory configuration element.This constructor is called when there is a JDBCConnectionConfiguration specified in the configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addConfigurationProperties
(Properties properties) Adds properties for this instance from any properties configured in the ConnectionFactory.Should return a connection to the database in use for this context.
-
Constructor Details
-
JDBCConnectionFactory
This constructor is called when there is a JDBCConnectionConfiguration specified in the configuration.- Parameters:
config
- the configuration
-
JDBCConnectionFactory
public JDBCConnectionFactory()This constructor is called when this connection factory is specified as the type in a ConnectionFactory configuration element.
-
-
Method Details
-
getConnection
Description copied from interface:ConnectionFactory
Should return a connection to the database in use for this context. The generator will call this method only one time for each context. The generator will close the connection.- Specified by:
getConnection
in interfaceConnectionFactory
- Returns:
- the connection
- Throws:
SQLException
- if there is some error obtaining the connection
-
addConfigurationProperties
Description copied from interface:ConnectionFactory
Adds properties for this instance from any properties configured in the ConnectionFactory.This method will be called before any of the get methods.
- Specified by:
addConfigurationProperties
in interfaceConnectionFactory
- Parameters:
properties
- All properties from the configuration
-