2

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.

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

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:

  • 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:

  • 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?

Thank you for any help that can be offered!

simonl
  • 1,240
  • 7
  • 19

1 Answers1

1

I sent a message to the Neo4j Google Group and got some feedback from Michael Hunger so I'm going to share here:

  • Turns out the cross store lib has been dormant for a while
  • JPA repos are not supported, only the EntityManager operations are
  • The cross store setup was not meant for a remote server and was not tested

So in summary my core understanding / assumptions were off!

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

simonl
  • 1,240
  • 7
  • 19
  • Hi Simon, so how did you end up wiring your application to these two types of resources ? Did you succeed with two different transaction managers ? That would be enough for me, I'm still trying to make my first JPA / Neo4J app take off http://stackoverflow.com/questions/32296676/tests-fail-with-a-transactionrequiredexception-no-transaction-is-in-progress-ex?noredirect=1#comment52612347_32296676 – Stephane Sep 09 '15 at 09:12
  • 1
    Hi @StephaneEybert, I ended up using two chaining two different transaction managers together and adopting the a best effort transaction management strategy. In our use case, the best effort pattern was good enough. Check out - http://stackoverflow.com/questions/15817909/implementing-spring-chainedtransactionmanager-according-to-the-best-efforts-1pc Am happy to help / chat more off SO as well. My username is simonl in the Neo4j slack group. – simonl Sep 09 '15 at 16:17
  • I'm now on the Slack Neo4j group. I didn't know about it. Thanks for the tip. I also went for a chained transaction manager as described at http://stackoverflow.com/questions/12749747/how-to-get-spring-data-neo4j-and-spring-data-jpa-to-work-together and solved my issue. You just handed me out a good day ! – Stephane Sep 10 '15 at 10:30