I have a database with a table that contains a column of type JSON. Retrieving all data from the table using the whole entity work without problems. But in a case when I use a native query with some joins and want to retrieve only specific columns Hibernate can't map properly the JSON column. In other cases when are no JSON columns I use interface projections and everything works fine. How can I retrieve the JSON column with projection?
My entity class is like this:
@Entity
public class EntityWithJsonColumn
...
@Type(type = "jsonb")
@Column(columnDefinition = "jsonb")
private Map<String,Object> additionalInfo;
...
and projection:
public interface DataProjection {
...
@Value("#{target.id}")
Long getID();
@Value("#{target.additionalInfo}")
Map<String,Object> getAdditionalInfo();
...
}
The error is No Dialect mapping for JDBC type: 1111;