sparkyspider
sparkyspider

Reputation: 13529

JPA / Hibernate: StringClobType deprecated

I recently upgraded Spring Boot and with this came a hibernate upgrade. Unfortunately, the entity column @Type(StringClobType) annotation has been deprecated. The documentation tell me I need to switch it to MaterilizedClobType.

Unfortunately this has broken my application.

I'm using PostgreSQL 9.5. The StringClobType annotation created a text type in the database which allowed me to store long text in the field. Unfortunately now, the string literal comes back when Hibernate is expecting some kind of LOB id.

This gives the error: Bad value for type long

Upvotes: 1

Views: 3163

Answers (1)

John Bollinger
John Bollinger

Reputation: 181149

The Hibernate @Type value that maps to PG's Text data type is org.hibernate.type.TextType. This is what you should use.

For what it's worth, this a sibling of org.hibernate.type.MaterializedClobType, which maps to CLOB; both are subclasses of org.hibernate.type.AbstractLongStringType.

Upvotes: 2

Related Questions