-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: WebLogic and connection
PostPosted: Fri Nov 14, 2003 1:37 pm 
Newbie

Joined: Tue Nov 11, 2003 6:24 pm
Posts: 17
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>


Top
 Profile  
 
 Post subject: what is your hibernate.cfg.xml JNDI name?
PostPosted: Fri Nov 14, 2003 4:14 pm 
Regular
Regular

Joined: Sun Sep 21, 2003 11:43 pm
Posts: 85
Location: Massachusetts
Is your JNDI locattion named:
"hibernate/my-DataSource" ?

Regards,
David


Top
 Profile  
 
 Post subject: all clear
PostPosted: Fri Nov 14, 2003 5:59 pm 
Newbie

Joined: Tue Nov 11, 2003 6:24 pm
Posts: 17
Looks like I was mistakenly closing the session before accessing the list accessor on my query object.

I upgraded to Hibernate 2.1 and am geting much more helpful output in my log when I do something silly.

Thanks,

-Alex


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.