Search the FirstSpirit Knowledge Base
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);
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
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
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
Hi Jamuna,
could you provide the complete code? With just some lines out of context it’s quite difficult to spot the problem.
Michael
Hi Michael,
Thanks !
Its working fine when calling the mediaDataset.save(); method.