Hope you have a nice day.
It is not easy to explain my issue.
JPA creates some complex objects for calculations, which are stored in a database. We decided to set the results in a working copy of this objects. This means for each object model we created a seperated working copy model file with the same fields but some other LocalDates values and new result fields. When the calculation was starting the working copies are instantiated. This approach is not the best i think. I think of the prototype pattern to clone the object. There i come to the problem how to add the new fields. How? Instantion costs and ist creates lots of additionals model class files. I only think of put the result field in the calculation data models as transient fields. Maybe inner class or local class? I also tried to use an interface as data bucket. But thats not the realy purpose of interfaces and also it works only with many curious trick. For Unit Tests and user input i think it is the best to use the builder pattern and then tell JPA to store the parent object, or not?
Thank you a lot friends
Aucun commentaire:
Enregistrer un commentaire