Announcement Announcement Module
Collapse
No announcement yet.
Consistent behavior of `save` Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Consistent behavior of `save`

    I have recently switched from Spring Data Neo4j to Spring Data JPA (over Hibernate). I had quite a few integration tests running against my DAO layer, some of which now fail.
    I am not sure if it is an explicit target of the Spring Data projects to keep the behavior consistent over different persistence providers (I'm assuming it is).
    So, here is the issues - in Hibernate, a merge on a new (detached) entity save the entity (expected). However, when setting a new, random id on that entity, you'd expect the operation to fail (with some sort of not found expception) since the entity with that id doens't actually exist. Instead, Hibernate silently ignores the id and persists the entity.
    This is not the behavior of Neo4j (which does fail).
    Since this is a Hibernate issue (which seems to have been dismissed without any kind of explination - https://hibernate.onjira.com/browse/HHH-979), I am thinking that Spring Data JPA may do the additional check to - first, have the behavior you'd expect from the persistence layer and second, to inline it's behavior across projects.
    Any feedback on this is appreciated.
    Thanks.
    Eugen.
Working...
X