Hibernate unidirectional ManyToMany delete only from association table
<p>I am fairly new to java and hibernate (with annotation) and not sure if the below is correct.  I have a unidirectional many to many relationship between two tables as in the example below:</p>

<pre><code>class Group { 
@ManyToMany(cascade = {CascadeType.ALL})
            @JoinTable(
                    name = "Group_Students",
                    joinColumns = @JoinColumn(name = "group_id", referencedColumnName="group_id),
                    inverseJoinColumns = @JoinColumn(name = "student_id", referencedColumnName="student_id)
            )
         private Set&lt;Student&gt; students;
}
</code></pre>

<p>The following works ok:
-   insert in table Student if I save an instance of Group -> this works ok
-   update in table Student if a student instance of the Group is modified -> this works ok
I want to delete the record from the Group and association table but keep the ones in the Student table. Currently before deleting the Group record, I set the instance’s student set to null (<code>students = null</code>). This seems to work perfectly, but I am not sure if this is the correct way to do it or if it is a bad practice – it seems that this solution is only a workaround and might cause issues in future. Do you have any other suggestions on how to do this?</p>