Closed quaff closed 8 years ago
https://vladmihalcea.com/2016/06/20/how-to-map-json-objects-using-generic-hibernate-types/ @Type(type = "json") @Column(columnDefinition = "json") private Location location; works fine. @Type(type = "json") @Column(columnDefinition = "json") private List<Location> locations; will failed. ( (ParameterType) parameters.get( PARAMETER_TYPE ) ).getReturnedClass() should return ParameterizedType instead of Class. Maybe AttributeConverter is a better solution.
@Type(type = "json") @Column(columnDefinition = "json") private Location location;
@Type(type = "json") @Column(columnDefinition = "json") private List<Location> locations;
( (ParameterType) parameters.get( PARAMETER_TYPE ) ).getReturnedClass()
It's intended to be like that because PostgreSQL and MySQL allow you to save a single root JSON object. Mapping a list of JSON objects is not, therefore, supported.
https://vladmihalcea.com/2016/06/20/how-to-map-json-objects-using-generic-hibernate-types/
@Type(type = "json") @Column(columnDefinition = "json") private Location location;
works fine.@Type(type = "json") @Column(columnDefinition = "json") private List<Location> locations;
will failed.( (ParameterType) parameters.get( PARAMETER_TYPE ) ).getReturnedClass()
should return ParameterizedType instead of Class. Maybe AttributeConverter is a better solution.