title: JPA deleting children ONLY, not parent, in OneToOne
body: <p>I had a quick question about ORM relationships with JPA Spring Data.</p>
  
  <p>I have </p>
  
  <p>AuthToken.java:</p>
  
  <pre><code>@OneToOne(optional=true, fetch = FetchType.EAGER, cascade=CascadeType.ALL, mappedBy="authToken")
  private User user;
  </code></pre>
  
  <p>User.java:</p>
  
  <pre><code>@OneToOne(optional=true, fetch = FetchType.EAGER, cascade=CascadeType.ALL)
  @JoinColumn(
        name="authorizationId", unique=true, nullable=true, updatable=true)
  private AuthorizationToken authToken;
  </code></pre>
  
  <p>My point here is the AuthToken should be nulled out when the token has expired.</p>
  
  <p>Trying to use CrudRepository to delete leads to "constraint/foreignkey" errors because it tries to delete BOTH PARENT+CHILD using CascadeType.ALL.</p>
  
  <p>I just want the TOKEN (child) to delete, not the user.</p>
  
  <p>Is there a proper way to write this out?</p>
  
  <p>What I ended up doing is: <code>Usr.setToken(null); UserRepo.save(Usr);</code></p>
  
  <p>I can't use AuthRepo.delete or AuthRepo.save anything like that.</p>
  
  <p>Using "delete" doesn't work right.</p>