org.springframework.data.mapping.model.MappingException:未知的持久化实体java.lang.String

时间:2014-04-19 14:05:22

标签: neo4j spring-data-neo4j

我已经从Spring-data-Neo4j 3.0.0升级到3.0.1以使用新的Label功能。 派生的查找程序(使用以前的版本)给出了这个例外:

org.springframework.data.mapping.model.MappingException: Unknown persistent entity java.lang.String

我无法找到原因:(

我试图在我的资源库查询器上添加@Query("MATCH (e:Event) WHERE e.title = {0} RETURN e"),但我得到了相同的异常

我认为它是一个Mongodb-Neo4j冲突,因为当我调试时,我在JdkDynamicAopProxy的invoke方法中看到,代理参数是org.springframework.data.mongodb.repository.support.SimpleMongoRepository@3c8f3375而我的我的实体用@NodeEntity注释,在上下文配置中我有:

<context:annotation-config/>
    <context:spring-configured/>
    <context:component-scan base-package="com.xxx"/>

    <!-- Neo4J -->

    <neo4j:config storeDirectory="D:/neo4j-enterprise-2.0.1/data/mydb" base-package="com.xxx.domain.graph" />
    <neo4j:repositories base-package="com.xxx.repository.graph" />


    <!-- MongoDB -->

    <!-- Factory bean that creates the Mongo instance --> 
    <mongo:mongo host="localhost" port="27017"> 
        <mongo:options
             connections-per-host="5"            
             connect-timeout="30000"
             max-wait-time="10000"           
             write-number="1"
             write-timeout="0"
             write-fsync="true"/>
    </mongo:mongo>

    <mongo:db-factory dbname="test" mongo-ref="mongo"/>

    <!-- MongoTemplate for connecting and quering the documents in the database -->  
    <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
        <constructor-arg ref="mongo"/>
        <constructor-arg name="databaseName" value="xxxx"/>
     </bean>
    <mongo:repositories base-package="com.xxx.repository.document" />

    <tx:annotation-driven mode="proxy"/>

1 个答案:

答案 0 :(得分:0)

如果有帮助,我必须将spring-data-commons升级到1.7.1

现在工作正常!