Hi guys,
I need to insert rows into table dynamically by Java API but not Rest API.
When I implementing it through saveContentEntity(ContentEntityObject obj, SaveContext saveContext)
or saveContentEntity(ContentEntityObject obj, ContentEntityObject origObj, SaveContext saveContext) , it throws org.hibernate.HibernateException: Unable to resolve owner of loading collection [[com.atlassian.confluence.core.ContentEntityObject.contentProperties#819205]] for second level caching .
Could somebody please give me some help? or some sample code for manipulating table dynamically by Java API
Thanks in advance.
Try this solution:
pageManager.saveNewVersion(targetPage, new PageModification(newPageContent), getDefaultSaveContext());
class PageModification implements Modification<Page> {
private String newBody;
public PageModification(String newBody) {
this.newBody = newBody;
}
@Override
public void modify(Page page) {
page.setBodyAsString(newBody);
page.setVersionComment("Page uploaded with same templates.");
}
}
private SaveContext getDefaultSaveContext() {
return DefaultSaveContext.builder().suppressNotifications(true).updateLastModifier(true).suppressEvents(false).build();
}
If you execute any user related actions from Job Module, you have to SET some active user or will receive an Exception.
AuthenticatedUserThreadLocal.set(userAccessor.getUserByName("admin"));
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did anyone resolve this issue? I'm having the same problem was random pages. Not sure the source of the error?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi hongchao, have you fixed it. I meet the same issue. Could you give me any suggestion on this. Thx!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks, but it still throw the same exception, ::>_<::
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In which module do you use it?
Macro? XWork? Something else?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
job-config module.
Is it up to module type? Could you please give me more details?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I implementd the same function on the Macro and Job-config module separately, and only Macro module works well.
It seems only Macro module support this approach ,is it correct?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.