mirror of https://github.com/apache/openjpa.git
OPENJPA-1351: fix ClassCastException when downlevel jdbc driver is used.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@825699 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6d50e87a03
commit
65d2ea8b19
|
@ -760,8 +760,22 @@ public class JDBCConfigurationImpl
|
||||||
public Object getConnectionFactory2() {
|
public Object getConnectionFactory2() {
|
||||||
// override to configure data source
|
// override to configure data source
|
||||||
if (dataSource2 == null) {
|
if (dataSource2 == null) {
|
||||||
// superclass will lookup from JNDI.
|
// superclass will lookup from JNDI.
|
||||||
DataSource ds = (DataSource) super.getConnectionFactory2();
|
Object obj = super.getConnectionFactory2();
|
||||||
|
DataSource ds = null;
|
||||||
|
if (obj != null) {
|
||||||
|
if (obj instanceof DataSource)
|
||||||
|
ds = (DataSource) obj;
|
||||||
|
else {
|
||||||
|
Log log = getLog(LOG_JDBC);
|
||||||
|
if (log.isTraceEnabled()) {
|
||||||
|
Localizer loc = Localizer.forPackage(JDBCConfigurationImpl.class);
|
||||||
|
log.trace(loc.get("unknown-datasource", getConnectionFactory2Name(),
|
||||||
|
obj.getClass().getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ds == null) {
|
if (ds == null) {
|
||||||
// the driver name is always required, so if not specified,
|
// the driver name is always required, so if not specified,
|
||||||
// then no connection factory 2
|
// then no connection factory 2
|
||||||
|
|
|
@ -244,3 +244,5 @@ connecting-for-dictionary: OpenJPA will now connect to the database to attempt \
|
||||||
the documentation for available values).
|
the documentation for available values).
|
||||||
map-factory: Using mapping factory "{0}".
|
map-factory: Using mapping factory "{0}".
|
||||||
meta-factory: Using metadata factory "{0}".
|
meta-factory: Using metadata factory "{0}".
|
||||||
|
unknown-datasource: JNDI lookup for "{0}" returned "{1}", which is not a \
|
||||||
|
javax.sql.DataSource object.
|
||||||
|
|
Loading…
Reference in New Issue