https://kotlinlang.org logo
#exposed
Title
# exposed
e

ESchouten

05/16/2022, 2:49 PM
Hi all, I've been thinking about generating Exposed Tables (and maybe entities) from POJO entity classes, I am looking for a way to keep my domain models pure data classes, so don't clutter them with JPA annotations, while preventing having to write and maintain a separate database definition like with Exposed DSL + DAO. Komapper comes close, but uses KSP and meta classes to map annotations on, inducing the need to maintain these together with the domain models, and preventing IDE level type checking. What I have in mind is a DSL based configuration per entity Anyone seeing any (fundemental) obstacles on the road for a solution like this? Or knows a library that does something like this?
e

Endre Deak

05/16/2022, 5:48 PM
looks promising to me
and haven’t seen anything similar out there so far
how would you check if config matches the entity definition? Preferably compile time
Copy code
entity<Address> {
    intProperty {
       property = Address::street
       ...
    }
}
e

ESchouten

05/17/2022, 5:18 AM
I guess we could infer property type from the entity, or indeed provide a custom property type like intProperty. We could also provide an Exposed-like transform function in the property config.
👍 1
2 Views