I have class with documents with link to attachments in another class.
I need to get RIDs and some (not all) fields.
My code:
final OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<ODocument>("select @rid as id, attachmentRID, field_1, field_2 from Mail");
for (ODocument record : resultset) {
ORID rid = ((ODocument)record.field("id")).getIdentity();
ORID arrachmentRid = ((ODocument)record.field("attachment")).getIdentity();
1) What's the proper way to get RID of document, or linked document?
I suppose that there is a better way, because I don't want to get all document, but only RIDs.
2) Is "select field_1, field_2, ... field_k from..." faster or require lower memory than getting all field "select * from... "?
Some of the fields stores files, and I don't want to download them from the database, when it's not necessary. Should I put them into different class and use OType.Link?