Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>I have @OnDelete annotation on all the @OneToMany members. What would be the order of deletion of these objects when the parent object is removed. Is it safe to assume that it would be the order in which the objects are declared.</p> </blockquote> <p>So you are using a <strong>SQL cascade delete on deletion</strong> instead of the regular Hibernate mechanism. Since you're using a database mechanism, I'm tempted to say the order in which the objects are declared does not matter (the database is simply not aware of this order) and I would just expect the database to handle things appropriately.</p> <p>It might influence the order of columns if you are generating the model from annotations though but:</p> <ul> <li>I'd be very surprised if this had any impact, that would make everything extremely fragile, unusable.</li> <li>Hibernate/JPA doesn't say anything about the order of columns (because this shouldn't matter, see above).</li> </ul> <blockquote> <p>But I ran into few issues, if B inturn has a foreign key reference to A which causes A to fail on deletion</p> </blockquote> <p>You should mention that in the question, <strong>this is very relevant</strong> IMO. Take my answer with a grain of salt but as I said, I'd expect a database engine to handle things appropriately, a database engine has all the required metadata to do it. But I'm not a database expert, I'm not sure what the theory says. </p> <p>Maybe have a look at questions such as:</p> <ul> <li><a href="https://stackoverflow.com/questions/1637708/what-is-the-problem-with-foreign-key-cascade-multiple-paths-and-cycles">What is the problem with foreign key cascade multiple paths and cycles?</a> </li> <li><a href="https://stackoverflow.com/questions/60168/in-what-order-are-on-delete-cascade-constraints-processed">In what order are ON DELETE CASCADE constraints processed?</a></li> <li>etc etc etc</li> </ul> <p>Or ask a question about the theory (and the practice for a given engine).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload