bad value for type long: - Postgresql, Hibernate, Spring

后端 未结 4 715
忘掉有多难
忘掉有多难 2021-02-07 00:29

I wanna store an entity(a String + an image) in PostgresQL using Spring MVC and Hibernate Here is my table. The image is supposed to be the type of oid.

CREATE T         


        
4条回答
  •  臣服心动
    2021-02-07 00:50

    At first I tried to set

    @Column(columnDefinition = "text")
    

    instead of @Lob annotation, as already mentioned here. It worked for me on PostgreSQL, but with error org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [htmlText] in table [Question]; found [clob (Types#CLOB)], but expecting [text (Types#VARCHAR)]

    in my unit tests (on HSQLDB).

    Then it tried

    @Column(columnDefinition = "clob")
    

    And it works well on both PostgreSQL and HSQLDB!

提交回复
热议问题