Добрый день. В документации по
Object Service сказано, что есть 3 вида мэпинга:
1) По бизнес ключу. Здесь все понятно. Есть много примеров и сам пользовался неоднократно.
2) По GUID. Делать делал, но так и понял, как правильно настроить мэпинг полей. В книге Abap Objects лишь сказано следующее:
Цитата:
Persistent Object References
Just as you can use references in ABAP Objects to refer to an object from another object, so can you use persistent object references to refer to one persistent object from another. If you use a persistent object reference, the referenced object is automatically loaded from the database into the internal session.
Creation
To create a persistent object reference, you must provide two fields of the OS_GUID type in the database table of the referencing class. You must then map these two fields to an attribute of the persistent class. One of these fields contains the instance GUID, while the other contains the class GUID of the referenced persistent object. Together, these fields make up an Object Identity (OID). Persistent object references can therefore refer only to persistent objects with a GUID object identity. You must assign both fields to the same attribute in persistence mapping. The first field has the mapping type object reference, while the second has the mapping type class identifier.
With persistent object references, 1:1 relations, 1:N relations, and N:M relations can be realized between objects, in the same way that foreign key relationships exist between relational databases.
Проделать вышесказанное не получилось. Так и не понял где этот
mapping type находиться. Даже не получилось создать метод аксесор get_guid() в зависимой таблице, чтобы сослаться на нее где-то еще.
3) По бизнес ключу и GUID. Аналогично не вышло. В документации сказано сделать по GUID вторичный уникальный индекс. Делал наоборот

GUID primary key а по бизнес ключу создавал unique secondary index. Чтобы достучаться до объектов делал select по бизнес ключу, получал guid-ы, а уже потом по ним объекты (В старой системе нет IF_OS_QUERY_MANAGER).
Есть у кого-нибудь примеры? И может кто-то делал наследование от persistent класса. С чем едят Vertical mapping и Horizontal mapping? Примеры говорят, есть в новых модулях типа treasury. Но ковыряться в незнакомом модуле сложновато.