-->
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.  [ 1 post ] 
Author Message
 Post subject: No Hibernate Session bound to thread
PostPosted: Fri May 05, 2006 10:53 am 
Newbie

Joined: Fri May 05, 2006 10:37 am
Posts: 1
Hi all,
I have this problem: I have a java business that I have mapped in a applicationContext.xml

<bean id="configurazioneBusiness" class="it.package.ConfigurazioneBusinessImpl">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>

<bean id="configurazioneBusinessFactory" class="it.package.ConfigurazioneBusinessFactory">
<property name="configurazioneBusiness"><ref bean="configurazioneBusiness"/></property>
</bean>


I've make a new class named Loader.java, in those I wanna use this Business. In file applicationContext.xml I've wrote:

<bean id="loader" class="it.package.loader.Loader">
<property name="contrattoBusiness"><ref local="contrattoBusiness"/></property>
<property name="configurazioneBusiness"><ref local="configurazioneBusiness"/></property>
</bean>


This is file Loader.java:

public class Loader {
....
private static IConfigurazioneBusiness configurazioneBusiness;
...

Loader() {
ClassPathXmlApplicationContext classpathACtx = new ClassPathXmlApplicationContext("/applicationContext.xml");
}

public IConfigurazioneBusiness getConfigurazioneBusiness() {
return configurazioneBusiness;
}

public void setConfigurazioneBusiness(IConfigurazioneBusiness configurazioneBusiness) {
this.configurazioneBusiness = configurazioneBusiness;
}

....
public void test() {
....
this.getConfigurazioneBusiness().getName(); //method getName is in business
....
}

}


When I launch my application this is the error:

[java] 05-05-2006 16:32:31 [main] ERROR it.package.ConfigurazioneBusiness - getName
[java] org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
[java] at org.springframework.orm.hibernate3.LocalSessionFactoryBean$TransactionAwareInvocationHandler.invoke(LocalSessionFactoryBean.java:984)
[java] at $Proxy0.getCurrentSession(Unknown Source)
............


Can anyone help me? ...sorry for my english! :)

Thanks!
tommaso

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


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

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.