Jamuna
I'm new here

Could not find entity. Either the session of the entity does not match

Jump to solution

Hello All,

I am trying to insert the content into dataset using accessApi  .

Its working fine until refersh the datasource .

Afterthat i am getting the below Exception

Could not find entity. Either the session of the entity does not match or it is not persistent: de.espirit.or.impl.EntityImpl@d4acda{images,NEW,FS_ID=null,FS_VALID_FROM=null,FS_VALID_TO=null,FS_RELEASE_TO=null}

        ContentStoreRoot contentRoot =

                (ContentStoreRoot) this.storeAgent.getStore(Store.Type.CONTENTSTORE, false);

        Content2 content2 = contentRoot.getContent2ByName(content2Uid);

        Schema schema = content2.getSchema();

        Session session = schema.getSession();

        Entity entity = session.createEntity(content2.getEntityType().getName());

      

        mediaDataset = content2.getDataset(entity);

Labels (1)
Tags (1)
0 Kudos
1 Solution

Accepted Solutions
mbergmann
Crownpeak employee
Crownpeak employee

Re: Could not find entity. Either the session of the entity does not match

Jump to solution

Hi Jamuna,

do you call either session.commit() or mediaDataset.save() later? Calling only session.createEntity(...) without a later save/commit only creates a temporary entity that is not yet saved in the database.

Michael

View solution in original post

0 Kudos
4 Replies
mbergmann
Crownpeak employee
Crownpeak employee

Re: Could not find entity. Either the session of the entity does not match

Jump to solution

Hi Jamuna,

do you call either session.commit() or mediaDataset.save() later? Calling only session.createEntity(...) without a later save/commit only creates a temporary entity that is not yet saved in the database.

Michael

0 Kudos
Jamuna
I'm new here

Re: Could not find entity. Either the session of the entity does not match

Jump to solution

Hi Michael,

As you said, i have done the below code for commit action

mediaDataset.getParent().getSchema().getSession().commit( );

still, After the refresh action, I try to get the existing dataset by query and  i got Null as a result.

But if i close the java client and reopened then it works fine without any warnings.

If you know please explain the action of  datasource  refresh.

Thanks!

Jamuna

0 Kudos
mbergmann
Crownpeak employee
Crownpeak employee

Re: Could not find entity. Either the session of the entity does not match

Jump to solution

Hi Jamuna,

could you provide the complete code? With just some lines out of context it’s quite difficult to spot the problem.

Michael

0 Kudos
Jamuna
I'm new here

Re: Could not find entity. Either the session of the entity does not match

Jump to solution

Hi Michael,

Thanks !

Its working fine when calling the mediaDataset.save(); method.

0 Kudos