Skip to content

Commit

Permalink
Fixing the 'HibernateException: No Session found for current thread' …
Browse files Browse the repository at this point in the history
…error on Grails 2.5.0.
  • Loading branch information
paulbarker committed Sep 2, 2015
1 parent 1c0f6e7 commit 2c466ef
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -72,10 +72,12 @@ class Localization implements Serializable {
}

if (!msg) {
def lst = Localization.findAll(
"from org.grails.plugins.localization.Localization as x where x.code = ? and x.locale in ('*', ?, ?) order by x.relevance desc",
[code, locale.getLanguage(), locale.getLanguage() + locale.getCountry()])
msg = lst.size() > 0 ? lst[0].text : missingValue
Localization.withNewSession {
def lst = Localization.findAll(
"from org.grails.plugins.localization.Localization as x where x.code = ? and x.locale in ('*', ?, ?) order by x.relevance desc",
[code, locale.getLanguage(), locale.getLanguage() + locale.getCountry()])
msg = lst.size() > 0 ? lst[0].text : missingValue
}

if (maxCacheSize > 0) {
synchronized (cache) {
Expand Down

0 comments on commit 2c466ef

Please sign in to comment.