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:
|