Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>OK. Now I see where is an issue. You are using <code>LocalSessionFactoryBean</code>, who is based on <code>SpringSessionContext</code>, who, in turn, wants to have a <code>SessionHolder</code> in the transactional resources within <code>ThreadLocal</code>. But as far as AMQP Listener works within his own Thread, there is no any hook which register <code>sessionFactory</code> in the transactional resources. Something like <code>OpenSessionInViewFilter</code> for Spring MVC.</p> <p>Try to use </p> <pre><code>hibernate.current_session_context_class = local </code></pre> <p>as <code>hibernateProperties</code> for <code>LocalSessionFactoryBean</code>. I have never used <code>LocalSessionFactoryBean</code>. The JTA <code>SessionFactory</code> from EE container JNDI always works perfectly for all cases.</p> <p>UPDATE:</p> <p>Well, as far as you may use the same <code>IDataProvider</code> from MVC and from AMQP Listener, and the issue is around the <code>CurrentSessionContext</code>, where there is no <code>currentSession</code> within AMQP Thread, you have to do <code>sessionFactory.openSession()</code> manually from code of your <code>IDataProvider</code> implementation and only in case, if there is no <code>currentSession</code> within <code>currentSessionContext</code>. Something like this:</p> <pre><code>Session hibernateSession = null; try { hibernateSession = this.sessionFactory.getCurrentSession(); } catch(HibernateException he) { hibernateSession = this.sessionFactory.openSession(); } </code></pre> <p>Of course, you can write your onw <code>SpringSessionContext</code> variant and move that code to the <code>currentSession()</code></p> <p>I don't understand why it works the second attempt from Retry for you. In my test-case it fails anyway.</p> <p>Suppose there is something in your configuration, which takes care about <code>currentSession</code>, but you don't mention it.</p> <p>HTH</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload