-->
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.  [ 5 posts ] 
Author Message
 Post subject: No CurrentSessionContext configured exception.
PostPosted: Tue Oct 18, 2005 10:41 am 
Newbie

Joined: Tue Oct 18, 2005 10:28 am
Posts: 3
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: Hibernate3

Mapping documents: HardwareData

Full stack trace of any exception that occurs:
org.hibernate.HibernateException: No CurrentSessionContext configured!
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:602)
at jhomenet.dao.hibernate.HibernateDAOFactory.getCurrentSession(HibernateDAOFactory.java:67)
at jhomenet.dao.hibernate.HibernateDAOFactory.getHardwareDataDAO(HibernateDAOFactory.java:46)
at jhomenet.test.hibernate.TestCaseWithData.initData(TestCaseWithData.java:34)
at jhomenet.test.hibernate.TestCaseWithData.inTransaction(TestCaseWithData.java:47)
at jhomenet.test.hibernate.HibernateTest.runTest(HibernateTest.java:60)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)




Name and version of the database you are using: MySQL4.1

Debug level Hibernate log excerpt: debug

I'm new to Hibernate and I'm trying to adapt the code from the CaveatEmptor examples into an application I'm developing in J2SE. When I run the unit tests I get the exception above (No CurrentSessionContext configured!). I imagine it's probably something pretty simple, but what am I missing? Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 10:54 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Read the reference documentation of Hibernate and search for "CurrentSessionContext" in it. You are probably missing a setting in your hibernate.cfg.xml.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 10:55 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
And please continue in the regular User forum if your questions are not about Hibernate in Action or CaveatEmptor.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 06, 2006 6:59 am 
Beginner
Beginner

Joined: Mon Sep 04, 2006 7:18 am
Posts: 45
I also have the same problem, and I am also using the same database as you. Did you find out about it?


Top
 Profile  
 
 Post subject: It's a config issue
PostPosted: Sun Nov 12, 2006 2:53 pm 
Newbie

Joined: Sun Nov 12, 2006 2:48 pm
Posts: 1
For people like me who had the same problem while trying to get started, and found this post via a google search...

It's a simple configuration problem. You probably forgot to set the hibernate internal session context management in your hibernate.cfg.xml:

Code:
        <!-- Enable Hibernate's automatic session context management -->
        <property name="current_session_context_class">thread</property>


After I set this it worked for me (and gave me another error, but that's the next problem to solve ;-)

Happy hibernating,

Brendan.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.