Org.hibernate.MappingException: None Dialog Mapping for JDBC Type: 1111

I am using postgres v8.3, which has a column type as XML. DDL is as follows:

CREATE TABLE contact (
"ID" INTEGER NOT NULL , 
"NAME" VARCHAR NOT NULL,
"Details" XML , ......

In the display hbm.xml file, we map it as follows:

<key-property name="Details" type="java.lang.String" >
<column name="Details" />
</key-property>

and I think this is the cause of the error: There is no display of dialects for the JDBC type: 1111 when I run a select query using:

List<?> contactList= session.createSQLQuery("select * from contact where id=" + val.getId() + " and name= '" + val.getName + "'").list();

but how can I map the "XML" type to the java data type?

+5
source share
3 answers

You must specify your own column type using the class org.hibernate.usertype.UserTypeprovided by hibernate.

Here is a very good example.

Thank.

+2
source

Use addScalar();

for instance

session.createSQLQuery("select public.flcpool_backup()")
                                     .addScalar("id", Hibernate.BIG_INTEGER)
                                     .addScalar("caf_tbl_id", Hibernate.BIG_INTEGER)
                                     .executeUpdate();  
+1
source

Try defining the connection dialect " " in the hibernate.cfg.xml file for postgres. hibernate.dialect

0
source

All Articles