<style>
/* Changing the layout to use less space for mobiles */
@media screen and (max-device-width: 480px), screen and (-webkit-min-device-pixel-ratio: 2) {
#email-body { min-width: 30em !important; }
#email-page { padding: 8px !important; }
#email-banner { padding: 8px 8px 0 8px !important; }
#email-avatar { margin: 1px 8px 8px 0 !important; padding: 0 !important; }
#email-fields { padding: 0 8px 8px 8px !important; }
#email-gutter { width: 0 !important; }
}
</style>
<div id="email-body">
<table id="email-wrap" align="center" border="0" cellpadding="0" cellspacing="0" style="background-color:#f0f0f0;color:#000000;width:100%;">
<tr valign="top">
<td id="email-page" style="padding:16px !important;">
<table align="center" border="0" cellpadding="0" cellspacing="0" style="background-color:#ffffff;border:1px solid #bbbbbb;color:#000000;width:100%;">
<tr valign="top">
<td bgcolor="#3e4c4e" style="background-color:#3e4c4e;color:#ffffff;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;line-height:1;"><img src="https://www.jboss.org/dms/hibernate/images/jira/jiraheader_hibernate.png" alt="" style="vertical-align:top;" /></td>
</tr><tr valign="top">
<td id="email-banner" style="padding:32px 32px 0 32px;">
<table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;">
<tr valign="top">
<td style="color:#505050;font-family:Arial,FreeSans,Helvetica,sans-serif;padding:0;">
<img id="email-avatar" src="https://hibernate.onjira.com/secure/useravatar?ownerId=steve&avatarId=10346" alt="" height="48" width="48" border="0" align="left" style="padding:0;margin: 0 16px 16px 0;" />
<div id="email-action" style="padding: 0 0 8px 0;font-size:12px;line-height:18px;">
<a class="user-hover" rel="steve" id="email_steve" href="https://hibernate.onjira.com/secure/ViewProfile.jspa?name=steve" style="color:#6c797f;">Steve Ebersole</a>
commented on <img src="https://hibernate.onjira.com/images/icons/improvement.gif" height="16" width="16" border="0" align="absmiddle" alt="Improvement"> <a style='color:#6c797f;text-decoration:none;' href='https://hibernate.onjira.com/browse/HHH-1917'>HHH-1917</a>
</div>
<div id="email-summary" style="font-size:16px;line-height:20px;padding:2px 0 16px 0;">
<a style='color:#6c797f;text-decoration:none;' href='https://hibernate.onjira.com/browse/HHH-1917'><strong>Bulk Delete on the owning side of a ManyToMany relation needs to delete corresponding rows from the JoinTable</strong></a>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td id="email-fields" style="padding:0 32px 32px 32px;">
<table border="0" cellpadding="0" cellspacing="0" style="padding:0;text-align:left;width:100%;" width="100%">
<tr valign="top">
<td id="email-gutter" style="width:64px;white-space:nowrap;"></td>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td colspan="2" style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 16px 0;width:100%;">
<div class="comment-block" style="background-color:#edf5ff;border:1px solid #dddddd;color:#000000;padding:12px;"><p><span class="error">[17:37]</span> <brmeyer> happy to take a stab at it, but need a bit of direction – still digging in<br/>
<span class="error">[17:38]</span> <sebersole> org.hibernate.hql.internal.ast.QueryTranslatorImpl<br/>
<span class="error">[17:38]</span> <sebersole> is the center of the word for hql<br/>
<span class="error">[17:39]</span> <sebersole> if ( sqlAst.needsExecutor() ) {<br/>
<span class="error">[17:39]</span> <sebersole> thats the bit you want to look at ^^<br/>
<span class="error">[17:39]</span> <sebersole> inside org.hibernate.hql.internal.ast.exec.StatementExecutor is where the multi-table checks are done<br/>
<span class="error">[17:40]</span> <sebersole> heck, even 1-1<br/>
<span class="error">[17:40]</span> <sebersole> where the fk points to that thing<br/>
<span class="error">[17:40]</span> <sebersole> big can of worms<br/>
<span class="error">[17:41]</span> <brmeyer> ya<br/>
<span class="error">[17:41]</span> <sebersole> but yes, lets chat tomorrpow<br/>
<span class="error">[17:41]</span> <sebersole> the plan, btw, was always to add a "cascade" keyword <br/>
<span class="error">[17:41]</span> <brmeyer> sounds good<br/>
<span class="error">[17:41]</span> <brmeyer> ya, that would be awesome<br/>
<span class="error">[17:41]</span> <sebersole> delete User u cascade u.groups<br/>
<span class="error">[17:41]</span> <brmeyer> for those of us too lazy to set up cascading properly...<br/>
<span class="error">[17:42]</span> <sebersole> well this does not look at cascading<br/>
<span class="error">[17:42]</span> <sebersole> mapping-defined cascading i mean<br/>
<span class="error">[17:42]</span> <sebersole> nor should it<br/>
<span class="error">[17:42]</span> <sebersole> many-to-many is a big problem though<br/>
<span class="error">[17:43]</span> <sebersole> considering user&group are many-to-many, what does that hql mean?<br/>
<span class="error">[17:43]</span> <sebersole> you can't just arbitrarily delete realted groups<br/>
<span class="error">[17:43]</span> <sebersole> those groups, in turn, might be related to non-deleted users<br/>
<span class="error">[17:44]</span> <sebersole> thats the holy-grail of orphan removal <img class="emoticon" src="https://hibernate.onjira.com/images/icons/emoticons/smile.gif" height="20" width="20" align="absmiddle" alt="" border="0"/><br/>
<span class="error">[17:44]</span> <sebersole> knowing to delete groups when no users reference it<br/>
<span class="error">[17:45]</span> <sebersole> not something we want to get into<br/>
<span class="error">[17:45]</span> <brmeyer> agreed<br/>
<span class="error">[17:45]</span> <brmeyer> but<br/>
<span class="error">[17:45]</span> <sebersole> yes but<br/>
<span class="error">[17:45]</span> <sebersole> but cleaning up the association table is doable<br/>
<span class="error">[17:46]</span> <brmeyer> hahaha<br/>
<span class="error">[17:46]</span> <brmeyer> damn it, quit reading me<br/>
<span class="error">[17:46]</span> <sebersole> lol, not like this discussion has not happened 20 times already <img class="emoticon" src="https://hibernate.onjira.com/images/icons/emoticons/smile.gif" height="20" width="20" align="absmiddle" alt="" border="0"/><br/>
<span class="error">[17:46]</span> <brmeyer> right<br/>
<span class="error">[17:46]</span> <brmeyer> limit this purely to cleaning up the FK table<br/>
<span class="error">[17:46]</span> <brmeyer> incredibly useful on its own<br/>
<span class="error">[17:46]</span> <sebersole> the cascade you mean<br/>
<span class="error">[17:46]</span> <brmeyer> yep<br/>
<span class="error">[17:47]</span> <sebersole> well here is another option..<br/>
<span class="error">[17:47]</span> <sebersole> for fks pointing <b>to</b> these rows being deleted, we could "null out" the relation<br/>
<span class="error">[17:47]</span> <sebersole> for 1-1 and 1-m literally do set null<br/>
<span class="error">[17:48]</span> <sebersole> for m-n delete the row<br/>
<span class="error">[17:48]</span> <sebersole> as non-cascaded "norm"<br/>
<span class="error">[17:48]</span> <sebersole> though i still think this ought to be an option<br/>
<span class="error">[17:48]</span> <sebersole> either of the query, or setting<br/>
<span class="error">[17:49]</span> <sebersole> cascade keyword would be specifically cascading the delete<br/>
<span class="error">[17:49]</span> <brmeyer> right<br/>
<span class="error">[17:49]</span> <sebersole> and we would probably error on it in case of m-n<br/>
<span class="error">[17:49]</span> <sebersole> or ignore<br/>
<span class="error">[17:49]</span> <brmeyer> mind if I capture all this in JIRA?</p></div>
<div style="color:#505050;padding:4px 0 0 0;"> </div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td><!-- End #email-page -->
</tr>
<tr valign="top">
<td style="color:#505050;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:10px;line-height:14px;padding: 0 16px 16px 16px;text-align:center;">
This message is automatically generated by JIRA.<br />
If you think it was sent incorrectly, please contact your JIRA administrators<br />
For more information on JIRA, see: <a style='color:#6c797f;' href='http://www.atlassian.com/software/jira'>http://www.atlassian.com/software/jira</a>
</td>
</tr>
</table><!-- End #email-wrap -->
</div><!-- End #email-body -->