No Dialect mapping for JDBC type: 1111
Here the answer based on the comment from SubOptimal:
The error message actually says that one column type cannot be mapped to a database type by hibernate.
In my case it was the java.util.UUID
type I use as primary key in some of my entities. Just apply the annotation @Type(type="uuid-char")
(for postgres @Type(type="pg-uuid")
)
Mapping PostgreSQL JSON column to a Hibernate entity property
See PgJDBC bug #265.
PostgreSQL is excessively, annoyingly strict about data type conversions. It won't implicitly cast text
even to text-like values such as xml
and json
.
The strictly correct way to solve this problem is to write a custom Hibernate mapping type that uses the JDBC setObject
method. This can be a fair bit of hassle, so you might just want to make PostgreSQL less strict by creating a weaker cast.
As noted by @markdsievers in the comments and this blog post, the original solution in this answer bypasses JSON validation. So it's not really what you want. It's safer to write:
CREATE OR REPLACE FUNCTION json_intext(text) RETURNS json AS $$
SELECT json_in($1::cstring);
$$ LANGUAGE SQL IMMUTABLE;
CREATE CAST (text AS json) WITH FUNCTION json_intext(text) AS IMPLICIT;
AS IMPLICIT
tells PostgreSQL it can convert without being explicitly told to, allowing things like this to work:
regress=# CREATE TABLE jsontext(x json);
CREATE TABLE
regress=# PREPARE test(text) AS INSERT INTO jsontext(x) VALUES ($1);
PREPARE
regress=# EXECUTE test('{}')
INSERT 0 1
Thanks to @markdsievers for pointing out the issue.
Related Topics
Differencebetween 'Super' and 'Extends' in Java Generics
Gradle to Execute Java Class (Without Modifying Build.Gradle)
Which Is the Best Alternative for Java Serialization
How to Use Yamlpropertiesfactorybean to Load Yaml Files Using Spring Framework 4.1
Exception Starting Filter Struts2 - Tried Adding Jar'S, But Same Result
Java Fileoutputstream Create File If Not Exists
Registering and Using a Custom Java.Net.Url Protocol
How to Read Request.Getinputstream() Multiple Times
How to Enumerate Ip Addresses of All Enabled Nic Cards from Java
How to Convert a Byte Array to Its Numeric Value (Java)
Exception in Thread "Main" Java.Util.Nosuchelementexception
Java: How to Indent Xml Generated by Transformer
Difference Between Shutdown and Shutdownnow of Executor Service
Reserved Words as Names or Identifiers