[MGNLGROOVY-32] Inconsistent session returned when getting a QueryManager Created: 25/Nov/10  Updated: 19/Jan/11  Resolved: 27/Dec/10

Status: Closed
Project: Magnolia Groovy Module
Component/s: console, integration
Affects Version/s: 1.1
Fix Version/s: 1.1.1

Type: Bug Priority: Major
Reporter: Magnolia International Assignee: Federico Grilli
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 Description   

In the console, if one tries to obtain a QueryManager instance via a HierarchyManager, it's provided with the correct jcr session:

mgnl> q = ctx.getHierarchyManager('config').getQueryManager()
===> 
info.magnolia.cms.core.search.QueryManagerImpl@1ee3b2dd
mgnl> q.createQuery("select * from nt:base where contains(*, 'forum-jcr')", "sql")
===> 
info.magnolia.cms.core.search.QueryImpl@343b8714

... but if she tries to take the MgnlContext.getQueryManager() shortcut, it isn't:

mgnl> q = ctx.getQueryManager('config')
info.magnolia.cms.core.search.QueryManagerImpl@734a8075
mgnl> q.createQuery("select * from nt:base where contains(*, 'forum-jcr')", "sql")
RepositoryException: corresponding session has been closed

Generated at Mon Feb 12 05:54:53 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.