Посмотрел.
Что сказать, я был не прав, нельзя смешивать управляемые
Spring Framework'ом сессии и сессии с
hibernate.current_session_context_class =
thread, в таком случае
Spring Framework не создаст свою обертку, возвращаемую
getCurrentSession() и не будет привязывать такие сессии к транзакциям. Лучше не выставлять данный параметр или установить его явно в
org.springframework.orm.hibernate3.SpringSessionContext (для 3-го
Hibernate) или в
org.springframework.orm.hibernate4.SpringSessionContext (для 4-го).
Эксепшн
org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
at org.springframework.orm.hibernate3.SpringSessionContext.currentSession(SpringSessionContext.java:65)
свидетельствует о проблемах в управлении транзакциями, если ваш сервис не обернут в управляемую
Spring Framework'ом транзакцию, то
Spring и не помещает сессию в контекст. Нужно разбираться с настройками
AOP, у меня заработало так:
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true" rollback-for="java.lang.Exception" propagation="REQUIRED" />
<tx:method name="save*" rollback-for="java.lang.Exception" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
Кстати, вам может помочь настройка детального логирования
Spring, для этого в
classpath нужно добавить:
- slf4j-api.jar
- slf4j-log4j12.jar
- log4j.jar
а так же добавить файл
log4j.properties:
log4j.rootLogger=INFO, mainlogger
log4j.appender.mainlogger=org.apache.log4j.ConsoleAppender
log4j.appender.mainlogger.target=System.out
log4j.appender.mainlogger.layout=org.apache.log4j.PatternLayout
log4j.appender.mainlogger.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p [%c{1}] %m%n
#log4j.appender.mainlogger.Threshold=INFO
log4j.logger.org.springframework=DEBUG