Search code examples
postgresqljpaopenjpa

Using VARCHAR or TEXT as default String mapping in OpenJPA


By default, OpenJPA's postgres dictionary generates VARCHAR(255) for String fields without stated length. Can it be set up to generate VARCHAR or TEXT instead for all such fields, so that I don't need to repeat @Column(columnDefinition = "TEXT") everywhere? Of course, if the length is given explicitly, e.g. @Column(length = 128), the result should be VARCHAR(128). For that matter, do any other JPA providers allow this?


Solution

  • It seems that Hibernate supports this since 3.6: 6.5. Type Registry. Tracked by this JIRA issue: HHH-5138.