Story
I like to use H2 embedded database as a starting point when I start a new project, but later on, when I switch to use PostgreSQL, I was prompted org.postgresql.jdbc.PgConnection.createClob() is not yet implemented.
I have one property in my class is a String
type, as I marked as @Lob
and wish Hibernate will take care of the rest for me, but NO. I still get the same exception.
Solution
To solve this, I need to add the additional @Type(org.hibernate.type.TextType)
annotation to the property as well, and then it works nicely with PostgreSQL in addition to H2.
Lesson Learnt
org.hibernate.type.TextType
- A type that maps an SQLLONGVARCHAR
to a Java String@Type
- use this to define one of the Hibernate mappings to gain cross-platform support.