Announcement Announcement Module
Collapse
No announcement yet.
Cross store, creating a new entity. How? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cross store, creating a new entity. How?

    So I have a repository that extends GraphRepository. The Domain object is a cross store between SDN and SD JPA. I use partial = "true"

    When I create a new domain object, I call the repository.save(domainObject) method and get

    java.lang.IllegalStateException: Flushing detached entity without a persistent state, this had to be created first.

    So I remember Michael saying that you have to save it first through JPA then you can save through SDN.

    But how can you save through JPA without access to the entityManager in your repository, etc.

    Thanks

    Mark

  • #2
    Couldn't you inject the EM ? If you look at the cross-store tests (I know there are too few) you should see what's needed there.

    Thansk a lot

    Michael

    Comment


    • #3
      OK, I see how that works.

      Just two comments

      1) I am not a fan of active record approach. Nothing really why or wrong with it, I just like separate Repositories. I also like using active record in Grails though.
      2) I was hoping that the cross-store would do all, insert/update/delete/read to both databases with just one call for each, instead of insert and delete requiring two or three calls.

      With #2, I don't really see a big advantage of cross-store in SDN versus just having two different domain objects one for JPA and one for Neo4j, and have two repositories and such. While it might be slightly more code, it is easy to understand and figure out.

      And I wouldn't have been forced to change all my domain objects to Java, instead of easier Groovy.

      Is it much more difficult to add insert/delete to JPA and Neo4j in a single call?

      Thanks

      Mark

      Comment


      • #4
        In looking at the tests, in the configuration xml file, there seems to be a lot of beans defined in there. Are all of those necessary to get this to work.

        Thanks

        Mark

        Comment

        Working...
        X