I'm new to Hibernate and am having a problem using a connection obtained from DataSource managed by WL8.1.
I have placed Hibernate in JNDI and here is the code i'm using in my session bean to intialize my session.
Am I doing this correctly? I assume that I don't need to configure anything with regards to the DataSource in my hibernate xml config file?
Code snippet:
{
Object objref;
Context context = new InitialContext();
objref = context.lookup("hibernate");
javax.sql.DataSource ds = (javax.sql.DataSource)context.lookup("my-DataSource");
Connection connection = ds.getConnection();
SessionFactory sessionFactory = (SessionFactory)PortableRemoteObject.narrow(objref, SessionFactory.class);
if (sessionFactory == null)
{
throw new Exception("Null SessionFactory found?!");
}
session = sessionFactory.openSession(connection);
}
####<Nov 14, 2003 10:54:16 AM GMT-06:00> <Info> <myBean> <aharveyxp1> <cgServer> <ExecuteThread: '12' for queue: 'weblogic.kernel.Default'> <<anonymous>> <BEA1-000280A55D036F15A35E> <000000> <Session is currently disconnected>
|