Customer Address JPA Service
https://github.com/ZenWave360/zenwave-playground/tree/main/examples/kustomer-address-jpa
SpringBoot + Java microservice for a "Customer Address Service" using JPA for persistence for this Domain Model:
With these REST Endpoints:

And these Domain Events published to a Kafka Topic:

As defined on this
ZenWave Model for Customer Address JPA Service
/*** Sample ZenWave Model Definition.* Use zenwave-scripts.zdl to generate your code from this model definition.*/config {title "Project Name"basePackage "io.zenwave360.examples.kotlin"persistence jpadatabaseType postgresql// you can choose: DefaultProjectLayout, CleanHexagonalProjectLayout, LayeredProjectLayout, SimpleDomainProjectLayout, HexagonalProjectLayout, CleanArchitectureProjectLayoutlayout LayeredProjectLayout// these should match the values of openapi-generator-maven-plugin// used by the OpenAPIControllersPlugin and SpringWebTestClientPluginlayout.openApiApiPackage "{{basePackage}}.web"layout.openApiModelPackage "{{basePackage}}.web.dtos"openApiModelNameSuffix DTO}/*** Customer entity*/@aggregate@auditing // adds auditing fields to the entityentity Customer {name String required maxlength(254) /** Customer name */email String required maxlength(254) pattern(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/)/** Customer Addresses can be stored in a JSON column in the database. */@json addresses Address[] minlength(1) maxlength(5) {street String required maxlength(254)city String required maxlength(254)}}@auditingentity PaymentMethod {type PaymentMethodType requiredcardNumber String required}enum PaymentMethodType { VISA(1), MASTERCARD(2) }relationship OneToMany {@eagerCustomer{paymentMethods required maxlength(3)} to PaymentMethod{customer required}}// you can create 'inputs' as dtos for your service methods, or use entities directlyinput CustomerSearchCriteria {name Stringemail Stringcity Stringstate String}@rest("/customers")service CustomerService for (Customer) {@postcreateCustomer(Customer) Customer withEvents CustomerEvent@get("/{customerId}")getCustomer(id) Customer?@put("/{customerId}")updateCustomer(id, Customer) Customer? withEvents CustomerEvent@delete("/{customerId}")deleteCustomer(id) withEvents CustomerEvent@post({path: "/search", status: 200}) @paginatedsearchCustomers(CustomerSearchCriteria) Customer[]}@copy(Customer)@asyncapi({ channel: "CustomersChannel", topic: "customers" })event CustomerEvent {id Longversion Integer// all fields from Customer are copied here, but not relationshipspaymentMethods PaymentMethod[]}
And generated using this
ZenWave Scripts for Customer Address JPA Service
@import("io.zenwave360.sdk.plugins.customizations:kotlin-backend-application:2.1.0-SNAPSHOT")config {zdlFile "zenwave-model.zdl"plugins {ZDLToOpenAPIPlugin {idType integeridTypeFormat int64targetFile "src/main/resources/public/apis/openapi.yml"}ZDLToAsyncAPIPlugin {asyncapiVersion v3idType integeridTypeFormat int64targetFile "src/main/resources/public/apis/asyncapi.yml"// includeKafkaCommonHeaders true}BackendApplicationDefaultPlugin {templates "new io.zenwave360.sdk.plugins.kotlin.BackendApplicationKotlinTemplates()"includeEmitEventsImplementation truehaltOnFailFormatting false--force // overwite all files}OpenAPIControllersPlugin {openapiFile "src/main/resources/public/apis/openapi.yml"templates "new io.zenwave360.sdk.plugins.kotlin.OpenAPIControllersKotlinTemplates()"}SpringWebTestClientPlugin {openapiFile "src/main/resources/public/apis/openapi.yml"templates "new io.zenwave360.sdk.plugins.kotlin.SpringWebTestClientKotlinTemplates()"}SpringWebTestClientPlugin {openapiFile "src/main/resources/public/apis/openapi.yml"templates "new io.zenwave360.sdk.plugins.kotlin.SpringWebTestClientKotlinTemplates()"groupBy businessFlowbusinessFlowTestName CreateUpdateDeleteCustomerIntegrationTestoperationIds createCustomer,updateCustomer,deleteCustomer,getCustomer}OpenAPIKaratePlugin {openapiFile "src/main/resources/public/apis/openapi.yml"}OpenAPIKaratePlugin {openapiFile "src/main/resources/public/apis/openapi.yml"groupBy businessFlowbusinessFlowTestName CreateUpdateDeleteCustomerKarateTestoperationIds createCustomer,updateCustomer,deleteCustomer,getCustomer}}}
with [ZenWave Model Editor] for IntelliJ IDEA.