Open
Description
Hello,
I'm facing the following the challenge I have an Entity which has a Lazy parent entity which I want to always be serialised by Id. If by any chance the Parent Entity is uninitialised and proxied, then I will get null instead of the id in JSON.
Here is an example:
// jsonidentity referring to id property
Entity {
// id
Long id;
// lazy
// jsonreference alwaysId=true
Entity parent;
}
which I expected to be serialised in Json like this:
{
id: 10,
parent: 1
}
A possibility would be to use the feature SERIALIZE_IDENTIFIER_FOR_LAZY_NOT_LOADED_OBJECTS, but it will create an object with a property id where I only want the id as it unwrapped. So I see two solutions,
- making another feature "SERIALIZE_UNWRAPPED_IDENTIFIER_FOR_LAZY_NOT_LOADED_OBJECTS, 2) handling the NULLS in either the HibernateProxySerializer.serialize Method or HibernateProxySerializer.findProxied Method to always return init.getIdentifier() when initialised instead of null.
What are your thoughts
Metadata
Metadata
Assignees
Labels
No labels