I'm currently trying to serialize data that I've previously loaded via Hibernate. To recover type information I enabled default typing like this:
objectMapper.enableDefaultTyping(DefaultTyping.NON_CONCRETE_AND_ARRAYS,As.PROPERTY);
I also added identity-info to my entities via this anotation:
@JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class, property = "@id")
However when I deserialize @OneToMany
-relations that I have, deserialization fails because the PersistentBag does not have a session at this point. Because my programm is running without a container I can not fix this issue easily.
I'm also aware of the fact that there is this hibernate-datatype module for jackson but this doesn't solve the problem (I guess that module is primaliry used for respecting the LAZY_LOADING-hibernate-property).
So my idea to fix this was to not serialize a PersistentBag
but an ArrayList
instead. Is there an easy way to do this or do I have to write my own serializer (which I tried but without beeing successful)?