Hi all,

I have an issue with accessing the JCR from a model class after Magnolia 
startup. A content area has a model and calls a 
method to get latest content from a specific workspace. Model code looks as 
follows:

[code]try {
                jcrSession = MgnlContext.getJCRSession("trouble");              
                QueryManager jcrQueryManager = 
jcrSession.getWorkspace().getQueryManager();
                Query query = jcrQueryManager.createQuery(QUERY_STRING, 
Query.JCR_SQL2);                
                query.setLimit(1l); // only one result
                QueryResult queryResult = query.execute();                  
                RowIterator iterator = queryResult.getRows();               
                    
                    if (iterator.hasNext()) { 
                         // won't be entered
                         // ...

[/code]

After startup, I observe that the iterator is empty, although

* relevant node is present in public instance's trouble workspace (JCR app)
* exact same query from model used on public instance finds the node (JCR 
tools, query)
* all caches have been flushed (cache tools app)

This behaviour persists randomly (yes, sadly), I haven't found a reproducible 
way to fix the problem. However, the following actions influence the issue:

* publishing an asset
* republishing the item from the workspace
* open the browser console / network and force-reload the page

What am I doing wrong? Any ideas?

Kind Regards,

Dominik

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=a826d06c-8ba5-491e-b509-f6d5c222d0f1


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

  • [magnolia-user] Problem with ac... Dominik Jednoralski (via Magnolia Forums)

Reply via email to