In API calls, the following declaration doesn't work anymore after upgrading Confluence from 5.6.6 to 5.7.4:
Page thePage = pageManager.getPage(id); String theContent = thePage.getBodyAsString();
Community moderators have prevented the ability to post new answers.
getBodyAsString() method needs to wrapped in transaction.
Lazy loading of page properties like the body content fails when the constructor of the page object and the lazy loaders are not called within the same transaction.
The following code should work:
final String curVersionBody = transactionTemplate.execute(new TransactionCallback<String>() { @Override public String doInTransaction() { return pageManager.getPage(id).getBodyAsString(); }});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.