如何使用 Spring Data JPA + Neo4j 正确设置跨存储持久性? [英] How do I properly set up cross-store persistence using Spring Data JPA + Neo4j?
问题描述
我正在尝试运行一个非常小的 JPA + SDN(Spring Data Neo4j)交叉存储项目,并试图证明使用 JPA 存储库调用保存部分实体将在 Neo4j 中创建相应的节点.
I am trying to get a very minimal JPA + SDN (Spring Data Neo4j) cross store project running and am trying to demonstrate that saving a partial entity using a JPA repository call will create a corresponding node in Neo4j.
我已按照我在 SO、Google 和 Spring 的网站上找到的说明/建议进行操作,但目前仍然无法解决问题.我目前在以下位置创建了一个最小的测试项目:
I have followed the instructions / advice that I have been able to find on SO, Google and Spring's site but am currently still having trouble standing things up. I currently have a minimal test project created at:
https://github.com/simon-lam/sdn-cross-store-poc
该项目使用 Spring Boot 并有一个简单的域,其中包含一个图实体 GraphNodeEntity.java
和一个部分实体 PartialEntity.java
.我编写了一个非常基本的测试,PartialEntityRepositoryTest.java
,对部分实体进行保存,我看到:
The project uses Spring Boot and has a simple domain containing a graph entity, GraphNodeEntity.java
, and a partial entity, PartialEntity.java
. I have written a very basic test, PartialEntityRepositoryTest.java
, to do a save on the partial entity and am seeing:
- 似乎使用了错误的事务管理器,因为
CrossStoreNeo4jConfiguration
类没有正确地自动装配entityManagerFactory
,它为空 - 由于上述 ^,我的实体没有分配 ID
- 我在日志中根本没有看到任何 SDN 活动
- 我做错了什么吗?
- The wrong transaction manager seems to be used because the
CrossStoreNeo4jConfiguration
class does not properly autowireentityManagerFactory
, it is null - As a result of the above ^, no ID is assigned to my entity
- I do not see any SDN activity in the logs at all
- Am I doing something glaringly wrong?
更一般地说,我希望确认一些假设并更好地理解跨存储持久性支持:
More generally, I was hoping to confirm some assumptions and better understand cross store persistence support in general:
- 要启用它,我是否需要启用高级映射?
- 作为启用高级映射的一部分,我需要设置 AspectJ;这是否包括启用加载时间编织?如果是这样,这是通过使用
@EnableLoadTimeWeaving
配置来实现的吗? - 假设我的所有配置最终都被修复了,当我使用 JPA 存储库保留它们时,我是否应该期望看到部分节点保留在 Neo4j 中?这应该由由方面驱动的跨商店支持来处理,对吗?
感谢您提供的任何帮助!
Thank you for any help that can be offered!
推荐答案
我向 Neo4j Google Group 发送了一条消息,并从 Michael Hunger 那里得到了一些反馈,所以我将在这里分享:
I sent a message to the Neo4j Google Group and got some feedback from Michael Hunger so I'm going to share here:
- 结果是交叉存储库已经休眠了一段时间
- 不支持 JPA 存储库,仅支持 EntityManager 操作
- 跨商店设置不适用于远程服务器,也未经过测试
总而言之,我的核心理解/假设是错误的!
So in summary my core understanding / assumptions were off!
来源:https://groups.google.com/forum/#!话题/neo4j/FGI8692AVJQ
这篇关于如何使用 Spring Data JPA + Neo4j 正确设置跨存储持久性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!