Could not find entity. Either the session of the entity does not match
Author: Jamuna
Publication Date: 5/7/2020 16:01
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);
Tags: session
-
Author: mbergmann - 5/7/2020 20:26
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 -
Author: Jamuna - 5/8/2020 12:37
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 -
Author: mbergmann - 5/19/2020 8:29
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 -
Author: Jamuna - 5/28/2020 5:17
Hi Michael,
Thanks !
Its working fine when calling the mediaDataset.save(); method.
0
Please sign in to leave a comment.
Comments
4 comments