Announcement Announcement Module
Collapse
No announcement yet.
Basic Mapping vs Aspect4J SDN. findOne(id) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Basic Mapping vs Aspect4J SDN. findOne(id)

    So, I have been using the basic mapping and not using the AspectJ Mapping. First because I assume that this automatically creates Active Record approach in my Domain object, which I don't like Active Record. I mean I like it in Grails, but in all other development I like the Repository approach.

    But it appears that with the AspectJ approach you get more, like Proxies to fetch data when going down to associated objects in a domain object. More lazy loading approach which might make my code a bit easier.

    The reason why I ask, is I have code using repository in lots of places using the findOne(id) method and I think I expect findOne to always go get fresh data from the database, but it isn't. Meaning in a transaction before I remove a node, if in a different transaction I call findOne(id) on a node that has a relationship to that recently removed node, it is still in the node returned by findOne. And then when I fetch() that relationship with template.fetch() I get an error saying the node doesn't exist, which it doesn't.

    I have spent 3 days this week trying to get some simple code working, and getting frustrated with findOne. I think I will add a findById method to my repos and put an @Query on it doing a cypher query of what findOne is supposed to do.

    Thanks

    Mark

  • #2
    These are the delete and transactional semantics of neo4j. Nodes that have been deleted are still returned by findById aka findOne, only trying to modify or traverse from them will result in errors.

    Transactional semantics are - read committed, i.e. whenever another thread commits a transaction you can see the changes in your thread.

    Comment


    • #3
      Originally posted by MichaelHunger View Post
      These are the delete and transactional semantics of neo4j. Nodes that have been deleted are still returned by findById aka findOne, only trying to modify or traverse from them will result in errors.

      Transactional semantics are - read committed, i.e. whenever another thread commits a transaction you can see the changes in your thread.
      So my second transaction, that occurs after the first one has already committed, should not see the deleted data that was removed in the first transaction. But it is seeing the data still. These two transactions are serial, they will never be running at the same time. Always the first before the second. I wouldn't be able to run the second without the first one completing. client-http request to server, response comes back and if it comes back successful, then it calls another http request for the second transaction.

      Thanks

      Mark

      Comment


      • #4
        Correct, if the delete transaction happend before and the second one after the first one has been committed then it should never see the deleted data. If it does it is a bug.

        Comment


        • #5
          Been a little busy. Teaching the Enterprise Integration with Spring class for the first time, so having to spend time prepping.

          Will get back to this in a week or two.

          Thanks

          Mark

          Comment

          Working...
          X