Manipulate confluence table by Java API

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.


3 answers

0 vote
Gregor Kasmann Community Champion Oct 30, 2017

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;

        public void modify(Page page) {
            page.setVersionComment("Page uploaded with same templates.");


private SaveContext getDefaultSaveContext() {
        return DefaultSaveContext.builder().suppressNotifications(true).updateLastModifier(true).suppressEvents(false).build();

thanks, but it still throw the same exception,  ::>_<::

Gregor Kasmann Community Champion Oct 30, 2017

In which module do you use it?

Macro? XWork? Something else?

job-config module.

Is it up to module type? Could you please give me more details?

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?

0 vote
Gregor Kasmann Community Champion Nov 01, 2017

If you execute any user related actions from Job Module, you have to SET some active user or will receive an Exception.


Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

899 views 23 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you