No Dialect mapping for JDBC type: 2003

前端 未结 2 513
遇见更好的自我
遇见更好的自我 2021-01-13 06:05

Though there are some question exists with this title , but my query does not solve from those thread.

I am executing recursive (using with clause) query through hib

相关标签:
2条回答
  • 2021-01-13 06:37

    Use a package 'com.vladmihalcea:hibernate-types-52:2.8.0' or add your database dialect to yml file in resources:

    @Entity
    @TypeDefs({
            @TypeDef(name = "string-array", typeClass = StringArrayType.class),
            @TypeDef(name = "json", typeClass = JsonStringType.class),
            @TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)
    })
    public class Post implements Serializable {
    
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private Long id;
    
        @Type(type = "string-array")
        @Column(columnDefinition = "text[]")
        private String[] tags;
    
    0 讨论(0)
  • 2021-01-13 06:40

    Hibernate does not provide and Converter class/Mapper class to convert DB text[] datatype, For this either we can write our own converted type implementing UserType or we using sqlQuery.addScalar( "path", Hibernate.TEXT ); we can map text[] to text and then in java code we can split it from ','

    0 讨论(0)
提交回复
热议问题