For anyone interested, I have resolved the problem by calling the following from within a service:
/**
* createConnection creates a database connection using the java.sql.DriverManager
* The parameters used to make the connection are taken from the current session
* @return java.sql.Connection object
*/
Connection createConnection(){
oracle.jdbc.OracleConnection cnx = null
try {
sessionFactory?.currentSession?.doWork new Work(){
void execute(Connection c){
//convert the com.sun.proxy.$Proxy<nn> connection to Oracle
cnx = c.unwrap(oracle.jdbc.OracleConnection.class)
}
}
return cnx
}
catch (SQLException sqle){
RIMS.ConnectionService.log.error "Error in createConnection: ${sqle.message}"
}
return null
}
I also added:
import org.hibernate.jdbc.Work
and
def sessionFactory
to inject the sessionFactory bean.
This code is contained within a plugin without a dataSource.groovy file and is working well in my project.