[17:37] <brmeyer> happy to take a stab at it, but need a bit of direction – still digging in [17:38] <sebersole> org.hibernate.hql.internal.ast.QueryTranslatorImpl [17:38] <sebersole> is the center of the word for hql [17:39] <sebersole> if ( sqlAst.needsExecutor() ) { [17:39] <sebersole> thats the bit you want to look at ^^ [17:39] <sebersole> inside org.hibernate.hql.internal.ast.exec.StatementExecutor is where the multi-table checks are done [17:40] <sebersole> heck, even 1-1 [17:40] <sebersole> where the fk points to that thing [17:40] <sebersole> big can of worms [17:41] <brmeyer> ya [17:41] <sebersole> but yes, lets chat tomorrpow [17:41] <sebersole> the plan, btw, was always to add a "cascade" keyword [17:41] <brmeyer> sounds good [17:41] <brmeyer> ya, that would be awesome [17:41] <sebersole> delete User u cascade u.groups [17:41] <brmeyer> for those of us too lazy to set up cascading properly... [17:42] <sebersole> well this does not look at cascading [17:42] <sebersole> mapping-defined cascading i mean [17:42] <sebersole> nor should it [17:42] <sebersole> many-to-many is a big problem though [17:43] <sebersole> considering user&group are many-to-many, what does that hql mean? [17:43] <sebersole> you can't just arbitrarily delete realted groups [17:43] <sebersole> those groups, in turn, might be related to non-deleted users [17:44] <sebersole> thats the holy-grail of orphan removal [17:44] <sebersole> knowing to delete groups when no users reference it [17:45] <sebersole> not something we want to get into [17:45] <brmeyer> agreed [17:45] <brmeyer> but [17:45] <sebersole> yes but [17:45] <sebersole> but cleaning up the association table is doable [17:46] <brmeyer> hahaha [17:46] <brmeyer> damn it, quit reading me [17:46] <sebersole> lol, not like this discussion has not happened 20 times already [17:46] <brmeyer> right [17:46] <brmeyer> limit this purely to cleaning up the FK table [17:46] <brmeyer> incredibly useful on its own [17:46] <sebersole> the cascade you mean [17:46] <brmeyer> yep [17:47] <sebersole> well here is another option.. [17:47] <sebersole> for fks pointing to these rows being deleted, we could "null out" the relation [17:47] <sebersole> for 1-1 and 1-m literally do set null [17:48] <sebersole> for m-n delete the row [17:48] <sebersole> as non-cascaded "norm" [17:48] <sebersole> though i still think this ought to be an option [17:48] <sebersole> either of the query, or setting [17:49] <sebersole> cascade keyword would be specifically cascading the delete [17:49] <brmeyer> right [17:49] <sebersole> and we would probably error on it in case of m-n [17:49] <sebersole> or ignore [17:49] <brmeyer> mind if I capture all this in JIRA?
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[17:37] <brmeyer> happy to take a stab at it, but need a bit of direction – still digging in
[17:38] <sebersole> org.hibernate.hql.internal.ast.QueryTranslatorImpl
[17:38] <sebersole> is the center of the word for hql
[17:39] <sebersole> if ( sqlAst.needsExecutor() ) {
[17:39] <sebersole> thats the bit you want to look at ^^
[17:39] <sebersole> inside org.hibernate.hql.internal.ast.exec.StatementExecutor is where the multi-table checks are done
[17:40] <sebersole> heck, even 1-1
[17:40] <sebersole> where the fk points to that thing
[17:40] <sebersole> big can of worms
[17:41] <brmeyer> ya
[17:41] <sebersole> but yes, lets chat tomorrpow
[17:41] <sebersole> the plan, btw, was always to add a "cascade" keyword
[17:41] <brmeyer> sounds good
[17:41] <brmeyer> ya, that would be awesome
[17:41] <sebersole> delete User u cascade u.groups
[17:41] <brmeyer> for those of us too lazy to set up cascading properly...
[17:42] <sebersole> well this does not look at cascading
[17:42] <sebersole> mapping-defined cascading i mean
[17:42] <sebersole> nor should it
[17:42] <sebersole> many-to-many is a big problem though
[17:43] <sebersole> considering user&group are many-to-many, what does that hql mean?
[17:43] <sebersole> you can't just arbitrarily delete realted groups
[17:43] <sebersole> those groups, in turn, might be related to non-deleted users
[17:44] <sebersole> thats the holy-grail of orphan removal
[17:44] <sebersole> knowing to delete groups when no users reference it
[17:45] <sebersole> not something we want to get into
[17:45] <brmeyer> agreed
[17:45] <brmeyer> but
[17:45] <sebersole> yes but
[17:45] <sebersole> but cleaning up the association table is doable
[17:46] <brmeyer> hahaha
[17:46] <brmeyer> damn it, quit reading me
[17:46] <sebersole> lol, not like this discussion has not happened 20 times already
[17:46] <brmeyer> right
[17:46] <brmeyer> limit this purely to cleaning up the FK table
[17:46] <brmeyer> incredibly useful on its own
[17:46] <sebersole> the cascade you mean
[17:46] <brmeyer> yep
[17:47] <sebersole> well here is another option..
[17:47] <sebersole> for fks pointing to these rows being deleted, we could "null out" the relation
[17:47] <sebersole> for 1-1 and 1-m literally do set null
[17:48] <sebersole> for m-n delete the row
[17:48] <sebersole> as non-cascaded "norm"
[17:48] <sebersole> though i still think this ought to be an option
[17:48] <sebersole> either of the query, or setting
[17:49] <sebersole> cascade keyword would be specifically cascading the delete
[17:49] <brmeyer> right
[17:49] <sebersole> and we would probably error on it in case of m-n
[17:49] <sebersole> or ignore
[17:49] <brmeyer> mind if I capture all this in JIRA?