Hi there,

Thanks for your reply. Of course I have it defined.

Anyway,  I found a way to solve it but it was so complicated that I
actually ended up designing simple tracer instead of fully fledged
tracing.

To make multiple entity manager factories you have to use
LocalContainerEntityManagerFactoryBean instead of
LocalEntityManagerFactoryBean. The container factory allows you to
define path to persistence.xml. It turned out that class loader was
not able to load 2 files of the same name. Any way, Spring still
wasn't able to understand unitName attribute, and without it it
complained about 2 possible candidate beans for autowiring. To fix it,
you have to use Spring's factory-bean and factory-methods and then
inject entity managers manually. And this was a little bit too much
for me.

I have my simplified tracing in place. But any way, by looking and
running the JPA tracer example - the feature is quite nice :)

cheers,
Łukasz

On 15 May 2012 14:04, Babak Vahdat <babak.vah...@swissonline.ch> wrote:
> Hi
>
> Looking at the stacktrace you've provided I suspect you did *not* name the
> persistence unit as "qualitas-pu" inside your "persistence.xml". That's it
> should be something like:
>
>  <persistence-unit name="qualitas-pu" transaction-type="...">
>    <class>...</class>
>     ...
>
>    <properties>
>      <property name="..." value="..."/>
>      ...
>    </properties>
>
>  </persistence-unit>
>
> Can you maybe show your "persistence.xml". And what's your JPA provider?
> OpenJPA, EclipseLink or Hibernate-EntityManager? And could you maybe provide
> the complete stacktrace?
>
> Babak
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/2-persistence-units-in-Camel-tp5709844p5709965.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to