Aller au contenu

Services de données

Dernière révision : 28 octobre 2026 · Nouveautés de la plateforme

En bref Une base de données exposée en service, entité par entité.

Service de données : entités et source

Un service de données expose des tables d'une base sous forme d'entités, interrogeables par le protocole OData. Le modèle « Service OData », rangé dans le dossier « Odata » d'un projet application, décrit ces entités et le type de base. La connexion à la base, elle, n'appartient pas au modèle : elle vit dans la configuration de l'application déployée.

Créer un service à partir d'une base

  1. Dans le projet, « Actions » puis « Ajouter une ressource » : type « Odata Service », nom, clé et description.
  2. L'étape « Details » demande le type de base (H2, Oracle, PostgreSQL, SQL Server, MySQL, MariaDB), l'adresse de la base, l'utilisateur et le mot de passe. Le bouton suivant lit les tables de cette base : une entité par table, avec ses colonnes, leur type et leurs annotations.
  3. L'étape « Preview » montre les entités obtenues ; l'enregistrement crée le modèle.

L'adresse, l'utilisateur et le mot de passe saisis à la création servent une seule fois, à la lecture des tables. Ils ne sont enregistrés ni dans le modèle ni dans la configuration : la connexion de l'application se règle ensuite dans l'onglet « Source de données ».

Les zones de l'écran

L'éditeur a trois onglets : « Tables », « Source de données » et « JSON ».

Tables

Le tableau « Entités » liste les entités par « Nom de la table » et « Nom de la classe ». La flèche d'une ligne déplie son détail : « Imports », « Implémente », « Hérite de », et le tableau « Colonnes » avec, pour chacune, « Identifiant », « Nom », « Type Java », « Valeur par défaut » et « Annotations ». Les relations entre entités s'expriment par ces annotations. En édition, le bouton « + » d'un tableau ajoute une ligne, déjà dépliée, et la corbeille la supprime sans confirmation.

JSON

L'onglet « JSON » montre le même modèle en texte, présenté avec indentation. Une modification y est reprise par l'onglet « Tables » quand on y revient ; un simple changement de mise en forme ne marque pas le modèle modifié.

La source de données

L'onglet « Source de données » sépare deux niveaux, chacun dans sa carte.

Le type de base, porté par le modèle

La liste « Type de base » propose H2, PostgreSQL, Oracle, SQL Server, MySQL et MariaDB ; l'aide « Pilote embarqué » nomme le pilote correspondant. Le type choisit le pilote embarqué dans l'application générée : il change avec le modèle et s'enregistre avec le projet. L'application déployée garde le pilote de sa dernière publication ; après un changement de type, l'ordre est : enregistrer le projet, republier l'application, puis ajuster la connexion.

La connexion, portée par la configuration de l'application

La connexion (adresse, utilisateur, mot de passe, pilote, dialecte) est une partie du document de configuration de l'application, que le serveur de configuration de la plateforme lui fournit au démarrage à la place des valeurs par défaut de l'application générée. Elle ne fait pas partie du modèle et n'est pas versionnée avec lui. Ses clés sont préfixées par la clé de l'application puis celle du modèle, écrites en minuscules et sans séparateur :

CléChamp à l'écranValeur par défaut
application.modèle.datasource.jdbc-urlURL JDBCune base H2 locale au moteur
application.modèle.datasource.usernameUtilisateuridentifiant de la base H2 embarquée, à remplacer avant tout usage réel
application.modèle.datasource.passwordMot de passemot de passe de la base H2 embarquée, à remplacer avant tout usage réel
application.modèle.datasource.driverClassNameClasse du pilote JDBCorg.h2.Driver
application.modèle.jpa.database-platformle dialecte SQL, sous « Pilote et dialecte (avancé) »celui d'une base H2
application.modèle.jpa.databasele type de base, sous « Pilote et dialecte (avancé) »H2

La carte indique le document concerné (« Configuration de l'application … ») et, sous chaque champ, sa clé exacte. La pastille « Valeur par défaut du bundle » signale une clé qui porte encore la valeur par défaut, et « Défaut du bundle (clé absente de la configuration) » une clé absente du document. Le pilote et le dialecte se règlent sous « Pilote et dialecte (avancé) ». Un avertissement apparaît quand l'adresse ou le pilote ne correspondent pas au type de base ; « Reprendre ceux du type » les réaligne.

Enregistrer la connexion

  1. En édition, les champs de la carte se modifient. Les saisies restent dans le navigateur, sans rien écrire ; un point sur l'onglet signale une connexion modifiée et non enregistrée.
  2. « Enregistrer la connexion » demande confirmation, puis écrit tout de suite dans la configuration de l'application, indépendamment de l'enregistrement du projet. Seuls les champs modifiés sont écrits ; les autres clés du document restent intactes.
  3. L'application prend la nouvelle connexion à son prochain démarrage (redémarrage du moteur ou republication).

« Annuler les changements » abandonne les saisies. Si le document a été modifié entre-temps ailleurs, rien n'est écrit : un bandeau le signale et « Recharger » relit le document en réappliquant les saisies. Une application sans document de configuration démarre avec les valeurs par défaut ; le document est créé au premier enregistrement. Le déploiement de l'application ajoute lui aussi les clés manquantes, sans écraser celles qui existent. La lecture et l'écriture demandent les droits correspondants sur la configuration ; un refus est expliqué à l'écran. Les réglages de configuration d'une application sont décrits dans Configuration.

Changer le type de base sans enregistrer le projet bloque l'écriture de la connexion : elle doit correspondre au pilote de l'application déployée.

Enregistrement et lecture seule

Le modèle (tables, JSON, type de base) n'est marqué modifié qu'après une vraie modification, et s'enregistre avec le projet ; l'ouverture ne le marque jamais. En lecture seule, les tables et le JSON se consultent, et la carte de connexion se lit, champs désactivés et mot de passe masqué ; une note rappelle que « Modifier » permet de changer la connexion.

Sur téléphone et tablette

  • Sous 600 px de large, les onglets se partagent la largeur, les tableaux deviennent des cartes empilées et la page défile.
  • La carte de connexion passe sur une colonne, boutons en pleine largeur ; avec un pointeur tactile, les cibles font 44 px.
Documentation de la plateforme Clomoon, éditée par Clover Consulting · Mentions légales · Confidentialité · Contact
Skip to content

Data services

Last revised 28 October 2026 · Platform changelog

In short A database exposed as a service, entity by entity.

Data service: entities and source

A data service exposes the tables of a database as entities, queryable with the OData protocol. The “OData service” model, kept in the “Odata” folder of an application project, describes these entities and the database type. The connection to the database does not belong to the model: it lives in the configuration of the deployed application.

Creating a service from a database

  1. In the project, “Actions” then “Add new resource”: type “Odata Service”, name, key and description.
  2. The “Details” step asks for the database type (H2, Oracle, PostgreSQL, SQL Server, MySQL, MariaDB), the database address, the user and the password. The next button reads the tables of that database: one entity per table, with its columns, their type and their annotations.
  3. The “Preview” step shows the entities obtained; saving creates the model.

The address, user and password typed at creation are used once only, to read the tables. They are saved neither in the model nor in the configuration: the connection of the application is set afterwards in the “Data source” tab.

The areas of the screen

The editor has three tabs: “Tables”, “Data source” and “JSON”.

Tables

The “Entities” table lists the entities by “Table name” and “Class name”. The arrow of a row unfolds its details: “Imports”, “Implements”, “Extends”, and the “Columns” table with, for each, “Identifier”, “Name”, “Java type”, “Default value” and “Annotations”. Relations between entities are expressed by these annotations. In edit mode, the “+” button of a table adds a row, already unfolded, and the bin deletes it without confirmation.

JSON

The “JSON” tab shows the same model as text, indented. A change made there is picked up by the “Tables” tab when going back to it; a mere change of layout does not mark the model as modified.

The data source

The “Data source” tab separates two levels, each in its own card.

The database type, set by the model

The “Database type” list offers H2, PostgreSQL, Oracle, SQL Server, MySQL and MariaDB; the “Embedded driver” hint names the matching driver. The type chooses the driver embedded in the generated application: it changes with the model and is saved with the project. The deployed application keeps the driver of its last publication; after a change of type, the order is: save the project, publish the application again, then adjust the connection.

The connection, held in the application configuration

The connection (address, user, password, driver, dialect) is a part of the application's configuration document, which the platform's configuration server hands to the application when it starts, in place of the defaults of the generated application. It is not part of the model and is not versioned with it. Its keys are prefixed with the key of the application then that of the model, written in lower case and without separators:

KeyField on screenDefault value
application.model.datasource.jdbc-urlJDBC URLan H2 database local to the engine
application.model.datasource.usernameUserembedded H2 user, to be replaced before any real use
application.model.datasource.passwordPasswordembedded H2 password, to be replaced before any real use
application.model.datasource.driverClassNameJDBC driver classorg.h2.Driver
application.model.jpa.database-platformthe SQL dialect, under “Driver and dialect (advanced)”that of an H2 database
application.model.jpa.databasethe database type, under “Driver and dialect (advanced)”H2

The card names the document concerned (“Configuration of application …”) and, under each field, its exact key. The “Bundle default” pill flags a key still holding the default value, and “Bundle default (key missing from the configuration)” a key missing from the document. Driver and dialect are set under “Driver and dialect (advanced)”. A warning shows when the address or the driver do not match the database type; “Use those of the type” aligns them again.

Saving the connection

  1. In edit mode, the fields of the card can be changed. What is typed stays in the browser, without writing anything; a dot on the tab flags a connection changed and not saved.
  2. “Save connection” asks for confirmation, then writes straight away into the application configuration, independently of the project save. Only the changed fields are written; the other keys of the document stay untouched.
  3. The application takes the new connection at its next start (engine restart or new publication).

“Discard changes” drops what was typed. If the document was changed elsewhere in the meantime, nothing is written: a banner says so and “Reload” reads the document again, reapplying what was typed. An application without a configuration document starts with the defaults; the document is created at the first save. Deploying the application also adds the missing keys, without overwriting the existing ones. Reading and writing require the matching rights on the configuration; a refusal is explained on screen. The configuration settings of an application are described in Configuration.

Changing the database type without saving the project blocks writing the connection: it must match the driver of the deployed application.

Saving and read-only

The model (tables, JSON, database type) is marked modified only after a real change, and is saved with the project; opening never marks it. Read-only, the tables and the JSON can be viewed, and the connection card can be read, fields disabled and password hidden; a note reminds you that “Modify” allows changing the connection.

On phones and tablets

  • Under 600 px wide, the tabs share the width, the tables become stacked cards and the page scrolls.
  • The connection card goes to one column, buttons at full width; with a touch pointer, targets are 44 px.
Documentation for the Clomoon platform, published by Clover Consulting · Legal notice · Privacy · Contact