Skip to main content
This section explains the naming conventions used when using remote databases with DirectQuery. When DirectQuery is used, the application will dynamically convert all Datastore Field and Store Names into a remote version. The remote version of the Datastore fields is what our remote database fields and tables should be named. If the Database and name mapper are out of sync, then the remote Tables/Fields may not be discoverable by the application. The interface INameMapper is used to convert Datastore field and store names into a format that works with remote databases.

Reference DirectQueryNameMapper

The reference DirectQueryNameMapper class is responsible for converting names from one format into another. We use this to convert datastore fields or store names into a name that is more compatible with remote databases. Since some databases have strict naming conventions, we have designed our DirectQueryNameMapper to handle most database naming conventions. The reference DirectQueryNameMapper works by taking a datastore name and converting it into one with the following logic:
  • Entire name is converted to upper case
  • Spaces are replaced with underscores ’_’
  • CamelCase is split on the hump with underscores
So we can expect the following conversions to take place with the default DirectQueryNameMapper:

Custom Naming Conventions

If you want to use custom naming conventions then you must create a custom implementation of the INameMapper interface and mark it as a spring component using the @Primary annotation so that your implementation takes precedence over the referenceDirectQueryNameMapper. Then import your custom naming convention spring component into your ApplicationConfig (or into the FRTBConfig class).

Custom Naming Convention Example

Here we create a custom naming convention that converts a given name into uppercase and replaces spaces with underscores ’_’. First we create a function that will convert one way from the local name to the remote name:
However, we will have difficulties when converting remote names to local names. To handle this we can cache the names that we have already converted and perform the calculation when our CustomNameMapper is created. We will use the IDatastoreSchemaDescription to help us with our pre-caching.
Now we can complete our class by implementing the methods from the interface:
Finally, we add our custom name mapper to our ApplicationConfig (or into the FRTBConfig class):