1

I encountered a bug when creating an init script from the java classes for flyway with a postgresql database. If you have an attribute of type string with the @Lob annotation jpa buddy creates a script with the attribute of type TEXT. Hibernate expects this to be of type oid because postgresql stores large objects in a separated table.

IntelliJ IDEA 2022.2.1 (Ultimate Edition); JPA Buddy2022.5.2-222; Spring Boot 2.7.7; flyway 9.10.2; Postgresql 15.1

What should I do to make it generate OID?

aleksey.stukalov
  • 706
  • 4
  • 16
  • If you have an attribute of type string with the @Lob annotation jpa buddy creates a script with the attribute of type TEXT – K.Nicholas Jan 17 '23 at 13:54
  • What is the java type of the property? Text is a string, and with Postgres, doesn't need to be marked as a lob. Do you really want an OID? Let Hibernate generate the DDL instead of JPA Buddy then. – Chris Jan 17 '23 at 16:16
  • @K.Nicholas, thank you for helping us with answering the questions. Ping us via info@jpa-buddy.com to get your free JPA Buddy license as an active community member :) – aleksey.stukalov Jan 20 '23 at 08:06
  • 1
    @Chris, thank you for helping us with answering the questions. Ping us via info@jpa-buddy.com to get your free JPA Buddy license as an active community member :) – aleksey.stukalov Jan 20 '23 at 08:06

1 Answers1

0
  1. Open Type Mappings Settings (Tools -> JPA Buddy -> Database Versionong -> Type Mappings) 
  2. Select postgresql type 
  3. Add custom Mapping Type for the jakarta.persistence.Lob or javax.persistence.Lob or java.lang.LobString and mapping to oid SQL type

See the picture below: enter image description here

aleksey.stukalov
  • 706
  • 4
  • 16