HHH-8683 EntityEntry backport on master

Hey @gunnarmorling and @sanne
I had to make a few adjustments to port it to master, can you double check it.
(new pull request on the correct repo)
Won't this blow if another `EntityEntry` implementation is used?

We could have a method `deserialize()` on `EntityEntryFactory` which handles the deserialization of its corresponding entity entry type.