Bonjour je debute en hibernate sur spring et je ne comprend pas pourquoi


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
			org.hibernate.SessionFactory fact = getHibernateTemplate().getSessionFactory();
			org.hibernate.Session sess = this.getSessionFactory().getCurrentSession();
Me renvoit une erreur de se type

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
alors que par exemple , fonctionne tres bien
Code : Sélectionner tout - Visualiser dans une fenêtre à part
			getHibernateTemplate().get();
A priori en cherchant sur des forums US j'ai trouvés une histoire de transaction proxy
Mais le problême est qu'il faut que j'annonce mon bean dans cette transaction et ne peut pas definir tout mes beans sur ce type de proxy.


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
	<bean id="transactionInterceptor"
		class="org.springframework.transaction.interceptor.TransactionInterceptor">
		<property name="transactionManager" ref="transactionManager" />
		<property name="transactionAttributes">
			<props>
				<prop key="*">PROPAGATION_REQUIRED</prop>
			</props>
		</property>
	</bean>
 
	<bean id="autoProxyCreator"
		class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
		<property name="interceptorNames">
			<list>
				<idref local="transactionInterceptor" />
			</list>
		</property>
		<property name="beanNames">
			<list>
				<idref local="daoFerie" />
			</list>
		</property>
	</bean>
Donc je cherche a faire récupérer la session pour pouvoir utiliser le setFirstResult et le setMaxResult sur chacune de mes requetes pour un affichage de liste avec un systeme de page.


Si quelqu'un a une solution a mon probleme ou une façon élégante d'utiliser setFirstResult et le setMaxResult avec getHibernateTemplate() je suis preneur.


voila mon applicationcontext
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
 
<beans>
	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="configLocation">
			<value>file:src/hibernate.cfg.xml</value>
		</property>
	</bean>
 
	<bean id="transactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory">
			<ref local="sessionFactory" />
		</property>
	</bean>
	<bean id="daoFerie"
		class="fr.test.testFerie">
		<property name="sessionFactory">
			<ref local="sessionFactory" />
		</property>
	</bean>
</beans>
Merci d'avance a celui qui me viendra en aide