org.hibernate.MappingException:没有JDBC类型的Dialect映射:1111 for postgres spring data jpa

时间:2016-08-02 03:49:48

标签: spring postgresql hibernate spring-data-jpa postgresql-9.4

下面是我的表格,我正在使用带有弹簧数据jpa的PostgreSQL

public class Person 
{
    @Id
    @GeneratedValue( strategy = GenerationType.IDENTITY )
    @Column( name = "person_id" )
    private Long personId;
    private String givenName;
}

public class Address 
{
    @Id
    @GeneratedValue( strategy = GenerationType.IDENTITY )
    @Column( name = "address_id" )
    private Long addressId;

@ManyToOne
    @JoinColumn( name = "person_id", foreignKey = @ForeignKey( name = "fk_person_person_id" ) )
    Person person;
    private String Address;
}

以下是我的原生查询

 User.getAllUsersWithAddress=select to_json(p.*) AS person,to_json(a.*) AS Address from person p INNER JOIN address a ON p.person_id=a.person_id

@Query( nativeQuery = true )
List<Object[]> getAllUsersWithAddress( );

但查询是抛出异常  引起:org.hibernate.MappingException:没有JDBC类型的Dialect映射:1111 for postgres。 即使我添加下面添加的代码

public class PostgreSQLDialect extends PostgreSQL94Dialect
{
    public PostgreSQLDialect()
    {
        super();
        this.registerColumnType( Types.JAVA_OBJECT, "json" );
    }
}

如果要添加更多内容,请更正我。

0 个答案:

没有答案