columnDefinition = “TEXT” for all types of databases

前端 未结 4 1068
无人共我
无人共我 2021-02-20 03:53

Locally I use mysql, so when I use

 @Column(columnDefinition = \"TEXT\")

Unfortunately application have to run at different databases too, I\'

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-20 04:56

    If you use @LOB you'll have ORA-00932 exception with SQL containing DISTINCT (http://ora-00932.ora-code.com/)

    I think that the solution depends on the bytes size of your string. If its < 4000 bytes, you can try using @Column(name = "...", length = 4000)

    I suggest 4000 bytes for DB comptibility reason :

    • In oracle Oracle 8 to Oracle 11g, type VARCHAR2 max size is 4000 (A4 page format)
    • In DB2 10 for z/OS, type VARCHAR max size is 32704
    • In SQL Server 2012, type TEXT max size is 2,147,483,647 bytes

提交回复
热议问题