Ok, now we have a domain model - perhaps not the most exciting one, but it has everything we usually need: inheritance, custom data types, an enum.
So let's continue and go a little bit deeper: How about adding JPA hibernate annotations to our classes? Of course, we don't have to use hibernate, but it really doesn't matter, which ORM we take, the principle is always the same.
How can we add these annotations? The same way we have customized our setup before: By declaring injection points in the primary transformations, overriding these points with our custom logic in secondary transformation and then load this secondary transformation on workflow execution.
Enough theory, how does the code really looks like?
1) The normal POJO m2t transformation - here we added some empty methods, like preClassDeclaration and preAssociationFieldDeclaration
2) Override of these empty methods in hibernate injector - here we add our annotations
3) Loading in the runner happens exactly the same way as before - we don't need to change anything
This solution is ok, but now we have several new problems.
First of all, we have a lot of code to set meaningful defaults for multiplicity, naming and aggregation. This is ok as long as we have only one transformation, but what if we have more? This code should be in its own module, since such logic is not really related to the POJO generation.
And this creates a second problem - if we have 2 different transformations, adding of the default values and POJO generation, how can we trigger them one after another? For sure not manually.
Let's see how to define workflows next time.