如何使用Spring Data JPA + Neo4j正确设置跨存储持久性? [英] How do I properly set up cross-store persistence using Spring Data JPA + Neo4j?

查看:806
本文介绍了如何使用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 ,它为null

  • 由于上述^,没有为我的实体分配ID

  • 我没有看到任何SDN活动在日志中

  • 我做错了什么?

  • The wrong transaction manager seems to be used because the CrossStoreNeo4jConfiguration class does not properly autowire entityManagerFactory, 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 config完成的?

  • 假设我的所有配置最终都已修复,我是否应该看到当我使用JPA存储库持久化时,部分节点在Neo4j中持续存在?这应该由由方面驱动的跨店支持来处理吗?

  • To enable it, do I need to enable advanced mapping?
  • As part of enabling advanced mapping, I need to set up AspectJ; does this include enabling load time weaving? If so is this accomplished through using the @EnableLoadTimeWeaving config?
  • Assuming that all my configuration is eventually fixed, should I expect to see partial nodes persist in Neo4j when I persist them using a JPA repository? This should be handled by the cross store support which is driven by aspects right?

感谢您提供任何帮助!

推荐答案

我向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:


  • 结果显示跨店商店lib已暂停一段时间

  • 不支持JPA回购,只有EntityManager操作

  • 交叉存储设置不适用于远程服务器且未经过测试

总而言之,我的核心理解/假设已经结束!

So in summary my core understanding / assumptions were off!

来源: https://groups.google.com/forum/#!topic/neo4j/FGI8692AVJQ

这篇关于如何使用Spring Data JPA + Neo4j正确设置跨存储持久性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆