Created
October 9, 2019 18:21
Revisions
-
madz0 created this gist
Oct 9, 2019 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ Creat a package-info file in the models package and put the following contents in there: ```java @org.hibernate.annotations.TypeDef(name = "jsonb", typeClass = JsonBinaryType.class) package com.ourproject.model; import com.vladmihalcea.hibernate.type.json.JsonBinaryType; ``` I used `JsonBinaryType` in `hibernate-types-52` library. Then in the entity class, I removed `columnDefinition="jsonb"` from the `@Column` and only used `@Type(type = "jsonb")` This way, for the product, hibernate would map column to `jsonb` type. Then in the test folder inside the same package I added `package-info` with this contents: ```java @org.hibernate.annotations.TypeDef(name = "jsonb", typeClass = TextType.class) package com.ourproject.model; import org.hibernate.type.TextType; ``` Now when we run maven test hibernate generates `varchar(2147483647)` column type for the jsonb type and it solved.