Results 1 to 4 of 4

Thread: Cross store, creating a new entity. How?

  1. #1
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default 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. #2
    Join Date
    Jan 2011
    Location
    Dresden, Germany
    Posts
    525

    Default

    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

  3. #3
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default

    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

  4. #4
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •