On database backends supporting database schemata (like MSSQL and Oracle), OpenAccess ORM allows the concurrent use of more than one schema and permits the use of non-default schemata. This ability can be used for both reverse and forward engineering. So you can create an application where one persistent class is stored in one schema and another one is stored in another schema.
In order to specify the schema, you need to specify the table name. This can be done with the db-table-name extension of the class element in the application configuration file. You can control these entries from the Visual Studio with the mapping dialogs "DB Table Name" text box.
Map classes to different schemata
Assuming you have two persistent classes Person and Address and a person has a reference to an address.
<extension key="db-table-name" value="schema1.TabPers" />
<extension key="db-table-name" value="schema2.TabAddr" />
With the mapping as given in the example, the instances of the Person class would be persisted into the TabPers table of schema schema1, and the Address instances would be held in the TabAddr table of schema schema2. Instances of both types can be managed by the same ObjectScope at the same time.
The schema name is specified as part of the table name and is separated by a dot. When no schema is specified in the table name, the default schema of the connection is assumed (e.g. dbo for MSSQL or the user name for Oracle). The schema name is the physical name of the schema; there is no additional mapping. When the table name is delimited, the schema name must be delimited too.
Change key generator table name
When the HIGHLOW key generator is used, it might be necessary to control the key generator table in such a way, that it is either in the schema of the table it generates keys for or in a different schema. Per default, the 'voa_keygen' table is created in the same schema as the table for which it produces keys. You can alter that by using the db-key-generator extension element on the class level:
<extension key="db-table-name" value="schema1.Hallo" />
<extension key="property" value="tableName=schema2.tab_with_keys"/>
Here, the HIGHLOW key generator will use a table named tab_with_keys in the schema schema2 to hold an entry for the table Hallo of schema schema1 which contains the persistent data for class Test.
OpenAccess ORM does not create database schemata at the moment, they must exist when a table is attempted to be created or modified.