I donβt think your need is very common, so there is probably nothing there. Pretty sure nothing comes with Spring out of the box. Thus, option 3 is discarded.
The solution from 1 to 2 is basically a business one. Imagine that the message format changes after it is saved (for example, due to some error). What do you want to get now? Probably a fixed one that can only be obtained with option 1.
On the other hand, if you want to save it as evidence that the application tells the user, you can use either 1 or 2 (but in the first case you need to save the message format instead of its code).
In my opinion, the first option is the best. You will not be so worried about its performance, because this is probably not the bottleneck in your application. Maybe many of the many (instead of one to many) relationships between the message and the parameters can be good and can save you some memory, but this is not the main goal. In the parameter table, you can save some additional information, such as the type of parameter. Thus, you can easily search, for example, all messages like msg1 or messages where the Jakub user is printing (since you saved this parameter as a user view).
Finally, never store serialized objects in your database. They depend on the language, you cannot look for them, problems with versions can arise ... and, most importantly, at least in this case you do not need it, since in the end all parameters must be converted to strings.
source share