I've a problem that I've been working to fix it approximately 2 days but still I didn't find any solve about that problem.
I've one concrete and two implemented class which are FilteredObjectData, CustomerFilteredObjectJson and ProductFilteredObjectJson.
The classes are below:
@JsonSubTypes({
@JsonSubTypes.Type(value = CustomerFilteredObjectJson.class, name = "Customer"),
@JsonSubTypes.Type(value = ProductFilteredObjectJson.class, name = "Product")}
)
public abstract class FilteredObjectData implements Serializable {
private static final long serialVersionUID = -8746510068813833450L;
}
@Getter
@Setter
@NoArgsConstructor
public class CustomerFilteredObjectJson extends FilteredObjectData implements Serializable {
private static final long serialVersionUID = -5827825016371137372L;
private List<Long> cities;
private List<Long> distiricts;
private List<Long> channels;
private String salesmanCode;
private List<String> accountCodes;
private List<String> taxNumbers;
}
@Getter
@Setter
@NoArgsConstructor
public class ProductFilteredObjectJson extends FilteredObjectData implements Serializable {
private static final long serialVersionUID = 2310254379556207058L;
private List<String> productCodes;
}
At the same time I'm using @vladmihalcea's hibernate-type-52 framework.
Now, when I'm trying to get data from PostgreSQL, I'm getting an error like below;
com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Missing type id when trying to resolve subtype of [simple type, class io.salesart.core.entities.json.FilteredObjectData]: missing type id property 'type'
at [Source: (String)"{"productCodes": []}"; line: 1, column: 20]
What are causes that problem? Could you please help me ?
I was getting same error when I using Optional class.
e.g
Optional<Computer> computer = new Computer();
and storingthis.saveTo(computer)
directly into cache.But when I change method arugment as
this.saveTo(computer.get());
then issue solved.