Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Texo/EntityManagerObjectStore"
(New page: __TOC__ == Introduction == The Texo ObjectStore concept integrates the model layer with JPA. It makes it possible to query using an EClass or to perform cross reference queries. In addit...) |
|||
Line 3: | Line 3: | ||
== Introduction == | == Introduction == | ||
− | The Texo ObjectStore concept integrates the model layer with JPA. It makes it possible to query using an EClass | + | The Texo ObjectStore concept integrates the model layer with JPA. It provides the following functionality: |
+ | * It makes it possible to query using an EClass | ||
+ | * Supports cross reference queries | ||
+ | * Supports (de-)serialization with (de-)resolving of references in the XML/XMI against the ObjectStore (the database) | ||
== Jar files/Plugins == | == Jar files/Plugins == | ||
− | The Texo Object Store | + | The Texo Object Store is defined in the org.eclipse.emf.texo.server plugin which is part of the Texo runtime feature (see [[Texo/Download_and_Install|Download & Install]]). |
== Creating an Object Store == | == Creating an Object Store == | ||
Line 13: | Line 16: | ||
An Object Store instance can be created directly if you have an EntityManager available: | An Object Store instance can be created directly if you have an EntityManager available: | ||
<source lang="java">EntityManagerObjectStore objectStore = new EntityManagerObjectStore(); | <source lang="java">EntityManagerObjectStore objectStore = new EntityManagerObjectStore(); | ||
− | objectStore.setEntityManager( | + | objectStore.setEntityManager(entityManager); |
− | // the URI is used for de-resolving references when serializing to XML | + | // the URI is used for de-resolving references when serializing to XML, see below |
objectStore.setUri("http://jpa.test"); | objectStore.setUri("http://jpa.test"); | ||
</source> | </source> | ||
− | |||
− | |||
== Cross Reference Queries == | == Cross Reference Queries == | ||
+ | |||
+ | The ObjectStore allows you to retrieve all the objects which reference a certain target object: | ||
+ | <source lang="java"> | ||
+ | |||
+ | </source> | ||
+ | |||
+ | In a later version the cross-reference api will be extended to only query for non-contained references. | ||
== (De-)Serializing XML with correct id's == | == (De-)Serializing XML with correct id's == |
Revision as of 14:49, 24 August 2011
Contents
Introduction
The Texo ObjectStore concept integrates the model layer with JPA. It provides the following functionality:
- It makes it possible to query using an EClass
- Supports cross reference queries
- Supports (de-)serialization with (de-)resolving of references in the XML/XMI against the ObjectStore (the database)
Jar files/Plugins
The Texo Object Store is defined in the org.eclipse.emf.texo.server plugin which is part of the Texo runtime feature (see Download & Install).
Creating an Object Store
An Object Store instance can be created directly if you have an EntityManager available:
EntityManagerObjectStore objectStore = new EntityManagerObjectStore(); objectStore.setEntityManager(entityManager); // the URI is used for de-resolving references when serializing to XML, see below objectStore.setUri("http://jpa.test");
Cross Reference Queries
The ObjectStore allows you to retrieve all the objects which reference a certain target object:
In a later version the cross-reference api will be extended to only query for non-contained references.
(De-)Serializing XML with correct id's
When (de-)serializing XML most of the time the references to other objects should be serialized as external references (the referenced object is not present in the XML). When de-serializing the XML these references should be correctly resolved to objects again. This resolving needs to be able to read the objects from the database again.
This (de-)resolving of references while reading from the database is done using the ObjectStore.