I have an parent class EdgeEntity
and a child class MigrationEdgeEntity extends EdgeEntity
.
Child does not have any new parameters. It's used for migration when some logic is altered/different then in the normal use of EdgeEntity
.
MigrationEdgeEntity
in the end saved as EdgeEntity
in the database.
I can use jackson annotations to make the API endpoint for migration to work. But then when I try to get EdgeEntitys
from the database it fails. If I don't use the annotations the API migration end point fails.
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION, defaultImpl = EdgeEntity.class)
@JsonSubTypes({@JsonSubTypes.Type(value = MigrationEdgeEntity.class, name = "migrationEdgeEntity")})
for EdgeEntity
And for MigrationEdgeEntity I have:
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION, property = "type")
@JsonTypeName("migrationEdgeEntity")
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
I don't understand much about jackson. So those might be the problem but somehow they work for the API
Not sure what to try next.
I am trying to migrate an EdgeEntity
to a system but there needs to be inherited and overloaded behavior. Kinda much of that actually.