Does Hibernate Support Postgres 9.2 Json Data Type?

Viewed 2461

It looks like Hibernate does not support Postgres Json datatype.

I am getting the following error:

javax.persistence.PersistenceException: org.hibernate.MappingException: No Dialect mapping for JDBC type: 1111

Configuration:

<bean id="entityManagerFactory"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="PGDataSource" />
        <property name="jpaVendorAdapter">
            <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                <property name="showSql" value="true" />
                <property name="generateDdl" value="true" />
                <property name="databasePlatform" value="org.hibernate.dialect.PostgreSQLDialect" />
            </bean>
        </property>         
    </bean>

Java Code:

query = "select row_to_json(row) from ( " + query + ") row";

EntityManager em = emf.createEntityManager();

List resultList = em.createNativeQuery(query).getResultList();
System.out.println("resultList " + resultList +  " resultList " + resultList.getClass());

Let me know if there are any workarounds.

1 Answers
Related