title: PERSISTENCE_DATAACCESS_EXCEPTION when trying to delete entity
body: <p>This is my book.java</p>
  
  <p>it has</p>
  
  <pre><code>@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
  private BookPeriodEnd period;
  </code></pre>
  
  <p>I want to delete a book object.</p>
  
  <p>After it,</p>
  
  <pre><code>  bookRepository.delete(book);
  </code></pre>
  
  <p>It deletes but gives error and does not delete from <code>bookperiodend</code>:</p>
  
  <blockquote>
    <p>org.springframework.orm.ObjectOptimisticLockingFailureException: Batch
    update returned unexpected row count from update [0]; actual row
    count: 0; expected: 1; nested exception is
    org.hibernate.StaleStateException: Batch update returned unexpected
    row count from update [0]; actual row count: 0; expected: 1</p>
  </blockquote>
  
  <p>also this</p>
  
  <blockquote>
    <p>INTERNAL_SERVER_ERROR(PERSISTENCE_DATAACCESS_EXCEPTION) -
    ObjectOptimisticLockingFailureException : Batch update returned
    unexpected row count from update [0]; actual row count: 0; expected:
    1; nested exception is org.hibernate.StaleStateException: Batch update
    returned unexpected row count from update [0]; actual row count: 0;
    expected: 1 (Batch update returned unexpected row count from update
    [0]; actual row count: 0; expected: 1)
    org.springframework.orm.ObjectOptimisticLockingFailureException: Batch
    update returned unexpected row count from update [0]; actual row
    count: 0; expected: 1; nested exception is
    org.hibernate.StaleStateException: Batch update returned unexpected
    row count from update [0]; actual row count: 0; expected: 1</p>
  </blockquote>
  
  <p>before error, it outputs those queries:</p>
  
  <pre><code>Hibernate: delete from book where id=? and version=?
  Hibernate: delete from book_period_end where id=? and version=?
  </code></pre>
  
  <p>but in the end it only deletes book.</p>
  
  <p>Why is that?</p>