Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok ! I am progressing ! I suspected something and it is confirmed. Ok so, in the example I gave you guys I only show one of the DAO configuration, I have an other DAO configuration (I have 2 database).</p> <p>So it seems that to work I have to add</p> <pre><code>&lt;tx:annotation-driven transaction-manager="hibernateTransactionManager"/&gt; </code></pre> <p>to my service configuration. So :</p> <pre><code>&lt;context:component-scan base-package="com.services" /&gt; &lt;context:annotation-config /&gt; &lt;tx:annotation-driven transaction-manager="hibernateTransactionManager"/&gt; </code></pre> <p>And it works (but only for one database). In database 1 conf I have : </p> <pre><code> &lt;tx:annotation-driven transaction-manager="hibernateTransactionManager"/&gt; </code></pre> <p>In database 2 conf I have : </p> <pre><code> &lt;tx:annotation-driven transaction-manager="hibernateTransactionManagerA"/&gt; </code></pre> <p>I tried to add both to the service conf :</p> <pre><code> &lt;context:component-scan base-package="com.services" /&gt; &lt;context:annotation-config /&gt; &lt;tx:annotation-driven transaction-manager="hibernateTransactionManager"/&gt; &lt;tx:annotation-driven transaction-manager="hibernateTransactionManagerA"/&gt; </code></pre> <p>But only the first database is working, when I try to access the DAO of the second one, I get the Session error (which make sense, only the the first transaction manager is use I would believe).</p> <p><strong>EDIT:</strong></p> <p>Ok, after reading the doc on multi-datasource, I just had to add :</p> <pre><code>&lt;qualifier value="managerTransactionA"/&gt; &lt;qualifier value="managerTransactionB"/&gt; </code></pre> <p>to my two hibernate manager transaction bean. And then just needed to add the proper transaction:</p> <pre><code>@Transactional("managerTransactionA") or @Transactional("managerTransactionB") </code></pre> <p>And it did the trick :) :)</p> <p>Thanks for your help guys !!!</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.
 

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