{"action":"created","comment":{"url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/pulls/comments/22526686","id":22526686,"diff_hunk":"@@ -60,7 +60,10 @@ class GormPersistentTokenRepository implements PersistentTokenRepository, Grails\n \t\tdef persistentToken\n \t\tdef clazz = lookupDomainClass()\n \t\tif (clazz) {\n-\t\t\tpersistentToken = clazz.get(seriesId)\n+\t\t\t// join an existing transaction if one is active\n+\t\t\tclazz.withTransaction { status ->","path":"src/groovy/grails/plugin/springsecurity/web/authentication/rememberme/GormPersistentTokenRepository.groovy","position":6,"original_position":6,"commit_id":"a38a460416371cf1089430dbc01dadfe060a5abf","original_commit_id":"a38a460416371cf1089430dbc01dadfe060a5abf","user":{"login":"beckje01","id":232059,"avatar_url":"https://avatars.githubusercontent.com/u/232059?v=3","gravatar_id":"","url":"https://api.github.com/users/beckje01","html_url":"https://github.com/beckje01","followers_url":"https://api.github.com/users/beckje01/followers","following_url":"https://api.github.com/users/beckje01/following{/other_user}","gists_url":"https://api.github.com/users/beckje01/gists{/gist_id}","starred_url":"https://api.github.com/users/beckje01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beckje01/subscriptions","organizations_url":"https://api.github.com/users/beckje01/orgs","repos_url":"https://api.github.com/users/beckje01/repos","events_url":"https://api.github.com/users/beckje01/events{/privacy}","received_events_url":"https://api.github.com/users/beckje01/received_events","type":"User","site_admin":false},"body":"Wouldn't it make more sense to use withNewSession instead? Not all GORM implementations support transactions but withNewSessions should work for all.","created_at":"2015-01-06T15:05:47Z","updated_at":"2015-01-06T15:05:47Z","html_url":"https://github.com/grails-plugins/grails-spring-security-core/pull/48#discussion_r22526686","pull_request_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/pulls/48","_links":{"self":{"href":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/pulls/comments/22526686"},"html":{"href":"https://github.com/grails-plugins/grails-spring-security-core/pull/48#discussion_r22526686"},"pull_request":{"href":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/pulls/48","id":23579719,"html_url":"https://github.com/grails-plugins/grails-spring-security-core/pull/48","diff_url":"https://github.com/grails-plugins/grails-spring-security-core/pull/48.diff","patch_url":"https://github.com/grails-plugins/grails-spring-security-core/pull/48.patch","issue_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/issues/48","number":48,"state":"open","locked":false,"title":"GPSPRINGSECURITYCORE-309 GormPersistentTokenRepository should use a transaction when retrieving persistent login","user":{"login":"tcrossland","id":759011,"avatar_url":"https://avatars.githubusercontent.com/u/759011?v=3","gravatar_id":"","url":"https://api.github.com/users/tcrossland","html_url":"https://github.com/tcrossland","followers_url":"https://api.github.com/users/tcrossland/followers","following_url":"https://api.github.com/users/tcrossland/following{/other_user}","gists_url":"https://api.github.com/users/tcrossland/gists{/gist_id}","starred_url":"https://api.github.com/users/tcrossland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tcrossland/subscriptions","organizations_url":"https://api.github.com/users/tcrossland/orgs","repos_url":"https://api.github.com/users/tcrossland/repos","events_url":"https://api.github.com/users/tcrossland/events{/privacy}","received_events_url":"https://api.github.com/users/tcrossland/received_events","type":"User","site_admin":false},"body":"See https://jira.grails.org/browse/GPSPRINGSECURITYCORE-309\r\n\r\nAfter updating from Grails 2.3.11 to Grails 2.4.4 I was getting the following stacktrace relating to the persistent login lookup.\r\n\r\n```\r\norg.springframework.dao.DataAccessResourceFailureException: Could not obtain current Hibernate Session; nested exception is org.hibernate.HibernateException: No Session found for current thread\r\n        at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.getSession(GrailsHibernateTemplate.java:210)\r\n        at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.doExecute(GrailsHibernateTemplate.java:166)\r\n        at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.get(GrailsHibernateTemplate.java:239)\r\n        at org.codehaus.groovy.grails.orm.hibernate.HibernateGormStaticApi.doGetInstance(HibernateGormStaticApi.groovy:129)\r\n        at org.codehaus.groovy.grails.orm.hibernate.HibernateGormStaticApi.get(HibernateGormStaticApi.groovy:123)\r\n        at net.bluetab.security.PersistentLogin.get(PersistentLogin.groovy)\r\n        at net.bluetab.security.PersistentLogin$get.call(Unknown Source)\r\n        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)\r\n        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)\r\n        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)\r\n        at grails.plugin.springsecurity.web.authentication.rememberme.GormPersistentTokenRepository.getTokenForSeries(GormPersistentTokenRepository.groovy:63)\r\n        at org.springframework.security.web.authentication.rememberme.PersistentTokenBasedRememberMeServices.processAutoLoginCookie(PersistentTokenBasedRememberMeServices.java:90)\r\n        at org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices.autoLogin(AbstractRememberMeServices.java:115)\r\n        at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:97)\r\n        ...\r\n```\r\n\r\nThis change should ensure there's a session present.","created_at":"2014-10-30T02:49:32Z","updated_at":"2015-01-06T15:05:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"156af6ec6050d350b00051f38e0f9223e034f52c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/pulls/48/commits","review_comments_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/pulls/48/comments","review_comment_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/pulls/comments/{number}","comments_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/issues/48/comments","statuses_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/statuses/a38a460416371cf1089430dbc01dadfe060a5abf","head":{"label":"tcrossland:patch-1","ref":"patch-1","sha":"a38a460416371cf1089430dbc01dadfe060a5abf","user":{"login":"tcrossland","id":759011,"avatar_url":"https://avatars.githubusercontent.com/u/759011?v=3","gravatar_id":"","url":"https://api.github.com/users/tcrossland","html_url":"https://github.com/tcrossland","followers_url":"https://api.github.com/users/tcrossland/followers","following_url":"https://api.github.com/users/tcrossland/following{/other_user}","gists_url":"https://api.github.com/users/tcrossland/gists{/gist_id}","starred_url":"https://api.github.com/users/tcrossland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tcrossland/subscriptions","organizations_url":"https://api.github.com/users/tcrossland/orgs","repos_url":"https://api.github.com/users/tcrossland/repos","events_url":"https://api.github.com/users/tcrossland/events{/privacy}","received_events_url":"https://api.github.com/users/tcrossland/received_events","type":"User","site_admin":false},"repo":{"id":14403143,"name":"grails-spring-security-core","full_name":"tcrossland/grails-spring-security-core","owner":{"login":"tcrossland","id":759011,"avatar_url":"https://avatars.githubusercontent.com/u/759011?v=3","gravatar_id":"","url":"https://api.github.com/users/tcrossland","html_url":"https://github.com/tcrossland","followers_url":"https://api.github.com/users/tcrossland/followers","following_url":"https://api.github.com/users/tcrossland/following{/other_user}","gists_url":"https://api.github.com/users/tcrossland/gists{/gist_id}","starred_url":"https://api.github.com/users/tcrossland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tcrossland/subscriptions","organizations_url":"https://api.github.com/users/tcrossland/orgs","repos_url":"https://api.github.com/users/tcrossland/repos","events_url":"https://api.github.com/users/tcrossland/events{/privacy}","received_events_url":"https://api.github.com/users/tcrossland/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tcrossland/grails-spring-security-core","description":"Grails Spring Security Core Plugin","fork":true,"url":"https://api.github.com/repos/tcrossland/grails-spring-security-core","forks_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/forks","keys_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/teams","hooks_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/hooks","issue_events_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/issues/events{/number}","events_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/events","assignees_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/assignees{/user}","branches_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/branches{/branch}","tags_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/tags","blobs_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/statuses/{sha}","languages_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/languages","stargazers_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/stargazers","contributors_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/contributors","subscribers_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/subscribers","subscription_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/subscription","commits_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/issues/comments/{number}","contents_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/contents/{+path}","compare_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/merges","archive_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/downloads","issues_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/issues{/number}","pulls_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/pulls{/number}","milestones_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/milestones{/number}","notifications_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/labels{/name}","releases_url":"https://api.github.com/repos/tcrossland/grails-spring-security-core/releases{/id}","created_at":"2013-11-14T18:18:36Z","updated_at":"2014-11-21T11:01:14Z","pushed_at":"2014-11-21T11:01:14Z","git_url":"git://github.com/tcrossland/grails-spring-security-core.git","ssh_url":"git@github.com:tcrossland/grails-spring-security-core.git","clone_url":"https://github.com/tcrossland/grails-spring-security-core.git","svn_url":"https://github.com/tcrossland/grails-spring-security-core","homepage":"","size":5302,"stargazers_count":0,"watchers_count":0,"language":"Groovy","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"grails-plugins:master","ref":"master","sha":"a8313d6ce2a7b4c701259890796f32cc51b4f16c","user":{"login":"grails-plugins","id":72412,"avatar_url":"https://avatars.githubusercontent.com/u/72412?v=3","gravatar_id":"","url":"https://api.github.com/users/grails-plugins","html_url":"https://github.com/grails-plugins","followers_url":"https://api.github.com/users/grails-plugins/followers","following_url":"https://api.github.com/users/grails-plugins/following{/other_user}","gists_url":"https://api.github.com/users/grails-plugins/gists{/gist_id}","starred_url":"https://api.github.com/users/grails-plugins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grails-plugins/subscriptions","organizations_url":"https://api.github.com/users/grails-plugins/orgs","repos_url":"https://api.github.com/users/grails-plugins/repos","events_url":"https://api.github.com/users/grails-plugins/events{/privacy}","received_events_url":"https://api.github.com/users/grails-plugins/received_events","type":"Organization","site_admin":false},"repo":{"id":574359,"name":"grails-spring-security-core","full_name":"grails-plugins/grails-spring-security-core","owner":{"login":"grails-plugins","id":72412,"avatar_url":"https://avatars.githubusercontent.com/u/72412?v=3","gravatar_id":"","url":"https://api.github.com/users/grails-plugins","html_url":"https://github.com/grails-plugins","followers_url":"https://api.github.com/users/grails-plugins/followers","following_url":"https://api.github.com/users/grails-plugins/following{/other_user}","gists_url":"https://api.github.com/users/grails-plugins/gists{/gist_id}","starred_url":"https://api.github.com/users/grails-plugins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grails-plugins/subscriptions","organizations_url":"https://api.github.com/users/grails-plugins/orgs","repos_url":"https://api.github.com/users/grails-plugins/repos","events_url":"https://api.github.com/users/grails-plugins/events{/privacy}","received_events_url":"https://api.github.com/users/grails-plugins/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/grails-plugins/grails-spring-security-core","description":"Grails Spring Security Core Plugin","fork":false,"url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core","forks_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/forks","keys_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/teams","hooks_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/hooks","issue_events_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/issues/events{/number}","events_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/events","assignees_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/assignees{/user}","branches_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/branches{/branch}","tags_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/tags","blobs_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/statuses/{sha}","languages_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/languages","stargazers_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/stargazers","contributors_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/contributors","subscribers_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/subscribers","subscription_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/subscription","commits_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/issues/comments/{number}","contents_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/contents/{+path}","compare_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/merges","archive_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/downloads","issues_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/issues{/number}","pulls_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/pulls{/number}","milestones_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/milestones{/number}","notifications_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/labels{/name}","releases_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/releases{/id}","created_at":"2010-03-22T17:44:03Z","updated_at":"2015-01-05T19:17:44Z","pushed_at":"2014-12-16T07:59:16Z","git_url":"git://github.com/grails-plugins/grails-spring-security-core.git","ssh_url":"git@github.com:grails-plugins/grails-spring-security-core.git","clone_url":"https://github.com/grails-plugins/grails-spring-security-core.git","svn_url":"https://github.com/grails-plugins/grails-spring-security-core","homepage":"","size":8103,"stargazers_count":132,"watchers_count":132,"language":"Groovy","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":126,"mirror_url":null,"open_issues_count":3,"forks":126,"open_issues":3,"watchers":132,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/pulls/48"},"html":{"href":"https://github.com/grails-plugins/grails-spring-security-core/pull/48"},"issue":{"href":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/issues/48"},"comments":{"href":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/grails-plugins/grails-spring-security-core/statuses/a38a460416371cf1089430dbc01dadfe060a5abf"}}}}