As indicated in the Notes (#1), when using the StringClobType with an
application server requires some additional code to get to the actual
database connection. To do this in JBoss (3.2) requires the following:
- Add $JBOSS_HOME/server/default/lib/jboss-common-jdbc-wrapper.jar to
the compiler classpath.
- Add the following import statement:
import org.jboss.resource.adapter.jdbc.WrappedConnection;
- Change the code that checks the validity of the connection object to
something like:
// Make sure connection object is right type
if (!oracleConnectionClass.isAssignableFrom(conn.getClass()))
{
if (conn.getClass().getName().startsWith("org.jboss"))
{
conn = ((WrappedConnection)conn).getUnderlyingConnection();
}
if (!oracleConnectionClass.isAssignableFrom(conn.getClass()))
{
throw new HibernateException("JDBC connection object must be a
oracle.jdbc.OracleConnection. " +
"Connection class is " +
conn.getClass().getName());
}
}
It's not rocket science, but hopefully this note will save somebody some
time.
Maury.... |