{"action":"created","issue":{"url":"https://api.github.com/repos/grails/grails-data-mapping/issues/950","repository_url":"https://api.github.com/repos/grails/grails-data-mapping","labels_url":"https://api.github.com/repos/grails/grails-data-mapping/issues/950/labels{/name}","comments_url":"https://api.github.com/repos/grails/grails-data-mapping/issues/950/comments","events_url":"https://api.github.com/repos/grails/grails-data-mapping/issues/950/events","html_url":"https://github.com/grails/grails-data-mapping/issues/950","id":230025427,"number":950,"title":"mappedBy doesnt seem to work in Gorm 6.0.9.RELEASE","user":{"login":"snimavat","id":623295,"avatar_url":"https://avatars3.githubusercontent.com/u/623295?v=3","gravatar_id":"","url":"https://api.github.com/users/snimavat","html_url":"https://github.com/snimavat","followers_url":"https://api.github.com/users/snimavat/followers","following_url":"https://api.github.com/users/snimavat/following{/other_user}","gists_url":"https://api.github.com/users/snimavat/gists{/gist_id}","starred_url":"https://api.github.com/users/snimavat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snimavat/subscriptions","organizations_url":"https://api.github.com/users/snimavat/orgs","repos_url":"https://api.github.com/users/snimavat/repos","events_url":"https://api.github.com/users/snimavat/events{/privacy}","received_events_url":"https://api.github.com/users/snimavat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/grails/grails-data-mapping/milestones/70","html_url":"https://github.com/grails/grails-data-mapping/milestone/70","labels_url":"https://api.github.com/repos/grails/grails-data-mapping/milestones/70/labels","id":2502588,"number":70,"title":"6.1.4","description":"","creator":{"login":"graemerocher","id":66626,"avatar_url":"https://avatars1.githubusercontent.com/u/66626?v=3","gravatar_id":"","url":"https://api.github.com/users/graemerocher","html_url":"https://github.com/graemerocher","followers_url":"https://api.github.com/users/graemerocher/followers","following_url":"https://api.github.com/users/graemerocher/following{/other_user}","gists_url":"https://api.github.com/users/graemerocher/gists{/gist_id}","starred_url":"https://api.github.com/users/graemerocher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graemerocher/subscriptions","organizations_url":"https://api.github.com/users/graemerocher/orgs","repos_url":"https://api.github.com/users/graemerocher/repos","events_url":"https://api.github.com/users/graemerocher/events{/privacy}","received_events_url":"https://api.github.com/users/graemerocher/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":4,"state":"open","created_at":"2017-05-05T14:39:36Z","updated_at":"2017-05-29T06:43:30Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2017-05-19T16:27:57Z","updated_at":"2017-05-29T07:23:40Z","closed_at":null,"body":"Given the domain classes \r\n\r\n```\r\nclass Org {\r\n\r\n\tString name\r\n\r\n\tOrgMember member\r\n\r\n\tstatic mappedBy = [member: \"org\"]\r\n\r\n\tstatic constraints = {\r\n\t\tmember nullable: true\r\n\t}\r\n\r\n\tstatic mapping = {\r\n\t\tid generator: \"assigned\"\r\n\t}\r\n\r\n}\r\n\r\n```\r\n\r\n```\r\nclass OrgMember {\r\n\tstatic belongsTo = [org:Org]\r\n\r\n\tOrg branch\r\n\tOrg division\r\n\tOrg region\r\n\r\n\t//static mappedBy = [branch:\"none\", division:\"none\", region:\"none\"] -- this also doesnt make any difference\r\n\r\n\tstatic constraints = {\r\n\t\torg nullable: false\r\n\t\tbranch nullable: true\r\n\t\tdivision nullable: true\r\n\t\tregion nullable: true\r\n\t}\r\n\t\r\n}\r\n```\r\n\r\nThe following query generates the wrong sql and fails with error (Not just the DetachedCriteria, Hql will fail with the same error too.)\r\n\r\n`OrgMember.where({branch == null}).updateAll(branch: branch)`\r\n\r\nGenerated sql query by hibernate\r\n\r\n`update org_member set id=? where id is null`\r\n\r\nError\r\n```\r\n\r\norg.h2.jdbc.JdbcSQLException: Parameter \"#1\" is not set; SQL statement:\r\nupdate org_member set id=? where id is null [90012-193]\r\n\tat org.h2.message.DbException.getJdbcSQLException(DbException.java:345)\r\n\tat org.h2.message.DbException.get(DbException.java:179)\r\n\tat org.h2.message.DbException.get(DbException.java:155)\r\n\tat org.h2.expression.Parameter.checkSet(Parameter.java:81)\r\n\tat org.h2.command.Prepared.checkParameters(Prepared.java:164)\r\n\tat org.h2.command.CommandContainer.update(CommandContainer.java:97)\r\n\tat org.h2.command.Command.executeUpdate(Command.java:258)\r\n\tat org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:160)\r\n\tat org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:146)\r\n\tat org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:204)\r\n\tat org.hibernate.hql.internal.ast.exec.BasicExecutor.doExecute(BasicExecutor.java:91)\r\n\tat org.hibernate.hql.internal.ast.exec.BasicExecutor.execute(BasicExecutor.java:60)\r\n\tat org.hibernate.hql.internal.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:429)\r\n\tat org.hibernate.engine.query.spi.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:374)\r\n\tat org.hibernate.internal.SessionImpl.executeUpdate(SessionImpl.java:1361)\r\n\tat org.hibernate.internal.QueryImpl.executeUpdate(QueryImpl.java:102)\r\n\tat org.grails.orm.hibernate.HibernateSession$2.doInHibernate(HibernateSession.java:145)\r\n\tat org.grails.orm.hibernate.HibernateSession$2.doInHibernate(HibernateSession.java:121)\r\n\tat org.grails.orm.hibernate.GrailsHibernateTemplate.doExecute(GrailsHibernateTemplate.java:286)\r\n```\r\n### Environment Information\r\n\r\n- **Operating System**: OSX\r\n- **GORM Version:**  6.0.9.RELEASE\r\n- **Grails Version:** 3.2.8\r\n- **JDK Version:** 1.8\r\n\r\n### Example Application\r\n[bug-report-19052017.zip](https://github.com/grails/grails-data-mapping/files/1014925/bug-report-19052017.zip)\r\n\r\nRun the OrgSpec in above example application to reproduce the error.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/grails/grails-data-mapping/issues/comments/304591491","html_url":"https://github.com/grails/grails-data-mapping/issues/950#issuecomment-304591491","issue_url":"https://api.github.com/repos/grails/grails-data-mapping/issues/950","id":304591491,"user":{"login":"graemerocher","id":66626,"avatar_url":"https://avatars1.githubusercontent.com/u/66626?v=3","gravatar_id":"","url":"https://api.github.com/users/graemerocher","html_url":"https://github.com/graemerocher","followers_url":"https://api.github.com/users/graemerocher/followers","following_url":"https://api.github.com/users/graemerocher/following{/other_user}","gists_url":"https://api.github.com/users/graemerocher/gists{/gist_id}","starred_url":"https://api.github.com/users/graemerocher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graemerocher/subscriptions","organizations_url":"https://api.github.com/users/graemerocher/orgs","repos_url":"https://api.github.com/users/graemerocher/repos","events_url":"https://api.github.com/users/graemerocher/events{/privacy}","received_events_url":"https://api.github.com/users/graemerocher/received_events","type":"User","site_admin":false},"created_at":"2017-05-29T07:23:40Z","updated_at":"2017-05-29T07:23:40Z","body":"Seems to work fine in 6.1.x. See the above test."}}
{"actor":{"display_login":"graemerocher"}}