Announcement Announcement Module
No announcement yet.
No Hibernate Session bound to thread,configuration does not allow of non-transaction Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • No Hibernate Session bound to thread,configuration does not allow of non-transaction


    Below is the complete scenario of my problem .. Please help

    Here is my XML configuration

    <bean id="feedDao" class="com.model.dao.hibernate.FeedDaoHibernateImp l">
    <property name="hibernateTemplate">
    <ref bean="hibernateTemplate" />

    <bean id="rssFeedMainServiceTarget" class="com.quanat.service.RSSFeedMainService">
    <property name="feedDao" ref="feedDao" />

    <bean id="rssFeedMainService" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager">
    <ref local="transactionManager" />
    <property name="target">
    <ref local="rssFeedMainServiceTarget" />
    <property name="transactionAttributes">
    <prop key="startRetriving">PROPAGATION_REQUIRED,-com.quanat.exception.ApplicationException</prop>

    <bean id="rssFeedMainServiceJob" class="org.springframework.scheduling.quartz.Metho dInvokingJobDetailFactoryBean">
    <property name="targetObject">
    <ref local="rssFeedMainService" />
    <property name="targetMethod" value="startRetriving" />

    <bean id="rssFeedMainServiceTrigger" class="org.springframework.scheduling.quartz.Simpl eTriggerBean">
    <property name="jobDetail">
    <ref local="rssFeedMainServiceJob" />
    <property name="startDelay" value="0" />
    <property name="repeatInterval" value="3600000" />


    Here is my method in DAO class

    public List<Feed> getAllFeeds(Long statusId) {
    Criteria criteria = getHibernateTemplate().getSessionFactory()
    if (!Utils.isEmpty(statusId)) {
    criteria.add(Restrictions.eq("isActive", statusId));
    criteria.setResultTransformer(CriteriaSpecificatio n.DISTINCT_ROOT_ENTITY);
    return criteria.list();

    when I simply use feedDao in startRetriving method it works fine as shown below.

    public void startRetriving() throws ApplicationException {
    List<Feed> feedList = feedDao.getAllFeeds(new Long(1));

    But when I use feedDao in annonymous innerclass that is also declared in StartRetriving method as shown below than exception occur "No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here"

    public void startRetriving() throws ApplicationException {

    feedr.addOnNotificationHandler(new InnerService() {

    public void onNotification(final SuperfeedrEventExtension event)
    List<Feed> feedList = feedDao.getAllFeeds(new Long(1));


  • #2
    Hello adnanjvd

    1) use code tags, is more readable for us
    2) Do you receive some error?, if yes, copy here the complete error stack trace
    with that information, we have a better idea about your problem