Announcement Announcement Module
No announcement yet.
How can use multiple persistence-unit with spring data jpa Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can use multiple persistence-unit with spring data jpa

    I am using


    I want to know how to tell <jpa:repositories> to use SharedEntityManagerBean?
    I have multiple jar's with different persistence units
    and at the time of autowire repo's it would fail saying "No unique bean EntityManagerFactory" : Exception given below
    org.springframework.beans.factory.NoSuchBeanDefini tionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single bean but found 2
    at otationBeanPostProcessor.findDefaultEntityManagerF actory( :536)
    at otationBeanPostProcessor.findEntityManagerFactory(

  • #2
    There's an entity-manager-factory-ref attribute at the repositories element that allows you to explicitly wire the EMF to all repositories discovered by that element to work with. Unfortunately the documentation doesn't seem to mention that attribute so I created DATADOC-91 [0].