Generate Java Package
After a domain model is ready, TeaQL can generate a Java package that application teams use from their services.
The common flow is:
Get license
-> model domain
-> generate Java package
-> commit and wait for CI
-> consume the package from Gradle
Define the Root Model
A root model can declare package-level identity such as service name, organization, and version:
<?xml version="1.0"?>
<root name="cmes" org="doublechaintech" version="118">
<_include file="cmes.xml"/>
</root>
The included model files define the business domain. The root file defines the generation target.
Generate the Package
Generation can run through the TeaQL generation process and CI pipeline. The important output is a versioned package that application services can depend on.
The package should be treated as generated output:
- update the model first;
- regenerate the package;
- do not hand-edit generated source files;
- keep application-specific behavior in extension points and service code.
Use from Gradle
After the package is published, application code can consume it through Gradle as a normal dependency.
The generated package gives the application:
- entities;
Qquery APIs;Esafe expressions;- checker and validation hooks;
- runtime integration points;
- generated request and selection APIs.
Application Code
Application code should use the generated APIs:
Q.orders()
.filterByMerchant(ctx.getMerchant())
.selectLineItemList(Q.lineItems().selectSku())
.executeForList(ctx);
If the model changes, regenerate the package instead of manually patching generated code.