Announcement Announcement Module
Collapse
No announcement yet.
MongoDB, Repositories, and a requirement of a JPA EntityManager? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MongoDB, Repositories, and a requirement of a JPA EntityManager?

    I've been following the instructions on how to use Repositories with Mongo, specifically a CRUD repo (http://static.springsource.org/sprin...ies.definition). When I try to start the app, I get an error about a javax.persistence.EntityManager:

    Caused by: org.springframework.beans.factory.NoSuchBeanDefini tionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single bean but found 0


    If I remove the interface that's extending CrudRepository, the error goes away. Is the the expected behavior and I'm missing a maven artifact or is something else wrong?

  • #2
    What you're referring to is the general purpose introduction that uses the JPA module as example to set up the XML namespace. You rather want to follow the Mongo specific section [0]. It boils down to changing the namespace to the mongo-db one.

    [0] http://static.springsource.org/sprin...ngo-repo-intro

    Comment


    • #3
      Omg, totally idiot moment. Completely missed that in the docs. thanks so much!

      Comment


      • #4
        ...sorry, I'm not getting there, i had this mongo repository working with spring-data-mongo, I extended it to use spring-data-rest, and with the exact same mongo configuration:

        <context:annotation-config />
        <mongo:db-factory host="localhost" port="27017"
        dbname="test" />
        <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.Mongo Template">
        <constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
        </bean>
        <mongo:repositories base-package="org.aprestos.labs.ee.domain.mongo_sdr.rep ositories" />
        ...

        ...now I'm not being able to load it up in jboss-as:
        "...No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single bean but found 0..."

        ...do you think this has to do with the config? I'm not sure what you mean about "...changing the namespace to the mongo-db one...".

        thanks in advance
        jtv

        Comment

        Working...
        X