Search the FirstSpirit Knowledge Base
Hi,
what mean "Attribute articles of entity type refs isn't simple".
This is the SchemaException I got when I try to rub this code...
Select select = sess.createSelect(content.getEntityType().getName());
Identifier id = article.getIdentifier();
Like filter = new Like("articles", id); // articles column are Entity Reference
select.setConstraint(filter);
EntityList entityList = sess.executeQuery(select);
How can I use a Entity/Identifier as a Like param.
Best Regards,
Antonio
Hi Antonio,
what you need is a simple value like int or String, not an object like an identifier.
This could work:
fillter=new Like("arcticles",(String)article.getValue("name"));
I don't know your Database but arcticles sounds like a list or an entity. I think you need something more like articles.name or so.
Here is a complete, working sample for the Mithras Example, I hope this can help you:
import de.espirit.firstspirit.access.store.IDProvider;
import de.espirit.firstspirit.access.store.Store;
import de.espirit.or.query.*;
import de.espirit.or.*;
productContent2Name = "products";
// showInfo
showInfo(String message) {
JOptionPane.showMessageDialog(null, message, "Seitentitel", JOptionPane.INFORMATION_MESSAGE);
}
contentStore = context.getUserService().getStore(Store.Type.CONTENTSTORE, false);
productContent2 = contentStore.getContent2ByName(productContent2Name);
schema = productContent2.getSchema();
session = schema.getSession();
select = session.createSelect(productContent2.getEntityType().getName());
like = new Like("Name_DE", "Accum 1");
select.setConstraint(like);
entityList = session.executeQuery(select);
showInfo(entityList.size()+"");
Best regards
Jan
Hi Jan,
I found the FSs relation column,
Like filter = new Like("arti_fs_id", article.getValue("fs_id").toString() );
tx & regards
Antonio
or like this...
Like filter = new Like("articles.fs_id", entity.getValue("fs_id").toString() );
Should also work without the "toString()" call.