hibernate - alternative way for many-to-many relationship in jpa -


jpa @manytomany how to write code with many-to-many relationships without the use of annotations Could? For example, when I delete the tag for the two categories software and Tags - it removes all the software I use it by using the different rules @manytomany < Tried to do with / code> annotation but it does not work. I have seen something similar to my question in this site but any code samples (I think it should be related to the @OneToMany both sides, but it would be good to get the code).

Or how to do this @manytomany if this is possible

More information: If we have soft 1, soft 2 and lt; - & gt; Tag 1, and soft 2 & lt; - & gt; Tag 2, and we remove tag 1, then only soft 1 should be removed. What hibernate can handle it? Try

@org Hibernate.Notation. Cascade ({org.hibernate.annotations.CascadeType.PERSIST, org.hibernate.annotations.CascadeType.MERGE, org.hibernate.annotations.CascadeType.REFRESH, org.hibernate.annotations.CascadeType.DETACH, org.hibernate

    • Delete software with ID: 5
    • deletes tagged with hibernate ID: 5 and 7
    • is removed from all lines of tagged software with the ID and cascade starts again, so you might end up with an empty dB.

Comments