{"action":"created","issue":{"url":"https://api.github.com/repos/grails/grails-data-mapping/issues/767","repository_url":"https://api.github.com/repos/grails/grails-data-mapping","labels_url":"https://api.github.com/repos/grails/grails-data-mapping/issues/767/labels{/name}","comments_url":"https://api.github.com/repos/grails/grails-data-mapping/issues/767/comments","events_url":"https://api.github.com/repos/grails/grails-data-mapping/issues/767/events","html_url":"https://github.com/grails/grails-data-mapping/issues/767","id":171053028,"number":767,"title":"Problem with Transactional on both Controller and Service in combination with multi-tenancy","user":{"login":"goeh","id":322721,"avatar_url":"https://avatars.githubusercontent.com/u/322721?v=3","gravatar_id":"","url":"https://api.github.com/users/goeh","html_url":"https://github.com/goeh","followers_url":"https://api.github.com/users/goeh/followers","following_url":"https://api.github.com/users/goeh/following{/other_user}","gists_url":"https://api.github.com/users/goeh/gists{/gist_id}","starred_url":"https://api.github.com/users/goeh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goeh/subscriptions","organizations_url":"https://api.github.com/users/goeh/orgs","repos_url":"https://api.github.com/users/goeh/repos","events_url":"https://api.github.com/users/goeh/events{/privacy}","received_events_url":"https://api.github.com/users/goeh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"graemerocher","id":66626,"avatar_url":"https://avatars.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},"assignees":[{"login":"graemerocher","id":66626,"avatar_url":"https://avatars.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}],"milestone":{"url":"https://api.github.com/repos/grails/grails-data-mapping/milestones/57","html_url":"https://github.com/grails/grails-data-mapping/milestones/6.1.0","labels_url":"https://api.github.com/repos/grails/grails-data-mapping/milestones/57/labels","id":1959885,"number":57,"title":"6.1.0","description":"","creator":{"login":"graemerocher","id":66626,"avatar_url":"https://avatars.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":6,"closed_issues":0,"state":"open","created_at":"2016-08-24T07:43:20Z","updated_at":"2016-08-29T14:32:04Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-08-14T10:43:38Z","updated_at":"2016-08-29T14:59:43Z","closed_at":null,"body":"Grails 3.2.0.M2\r\n```\r\ngrails.gorm.multiTenancy.mode: DISCRIMINATOR\r\n```\r\n\r\nIf I have a controller action marked as @Transactional that calls a service marked as @Transactional and I do this inside a withCurrent{ ... } multi-tenant block I get an exception.\r\n```\r\norg.springframework.transaction.IllegalTransactionStateException: Pre-bound JDBC Connection found!\r\nHibernateTransactionManager does not support running within DataSourceTransactionManager if told to manage the DataSource itself.\r\n```\r\n\r\nI have a test application here https://github.com/goeh/grails-session-issue\r\n\r\nPlease look in https://github.com/goeh/grails-session-issue/blob/master/grails-app/controllers/session/issue/PersonController.groovy for code examples.\r\n\r\nWhen running the integration test I get another exception:\r\n```\r\nERROR org.springframework.transaction.support.TransactionSynchronizationUtils -\r\n    TransactionSynchronization.beforeCompletion threw exception\r\n    org.hibernate.SessionException: Session is closed!\r\n    \tat org.hibernate.internal.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:132)\r\n    \tat org.hibernate.internal.SessionImpl.disconnect(SessionImpl.java:510)\r\n    \tat org.springframework.orm.hibernate5.SpringSessionSynchronization.beforeCompletion(SpringSessionSynchronization.java:123)\r\n```"},"comment":{"url":"https://api.github.com/repos/grails/grails-data-mapping/issues/comments/243150042","html_url":"https://github.com/grails/grails-data-mapping/issues/767#issuecomment-243150042","issue_url":"https://api.github.com/repos/grails/grails-data-mapping/issues/767","id":243150042,"user":{"login":"goeh","id":322721,"avatar_url":"https://avatars.githubusercontent.com/u/322721?v=3","gravatar_id":"","url":"https://api.github.com/users/goeh","html_url":"https://github.com/goeh","followers_url":"https://api.github.com/users/goeh/followers","following_url":"https://api.github.com/users/goeh/following{/other_user}","gists_url":"https://api.github.com/users/goeh/gists{/gist_id}","starred_url":"https://api.github.com/users/goeh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goeh/subscriptions","organizations_url":"https://api.github.com/users/goeh/orgs","repos_url":"https://api.github.com/users/goeh/repos","events_url":"https://api.github.com/users/goeh/events{/privacy}","received_events_url":"https://api.github.com/users/goeh/received_events","type":"User","site_admin":false},"created_at":"2016-08-29T14:59:43Z","updated_at":"2016-08-29T14:59:43Z","body":"Ok I understand. But it's a major limitation because I might not know what other service calls my code will trigger, and those services might use `@Transactional`. I'm thinking about plugins, etc.\r\nBut I guess that multi-tenancy is a major thing for Grails 3.2 and beyond so plugins you use must be multi-tenant aware. You cannot just pull in any plugin and hope it will work with multi-tenancy. I guess that's understandable.\r\nI will replace `@Transactional` with withCurrent and see how it goes. Thanks."}}
{"actor":{"display_login":"goeh"}}