Take the 2-minute tour ×

I am using postgres v8.3 which has a columntype as XML. DDL looks like this:

CREATE TABLE contact (
"Details" XML , ......

In the mapping hbm.xml file I map it like this:

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

and I guess this is the reason of error : No Dialect mapping for 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 what is the other way I can map "XML" type to a java datatype ?

share|improve this question
nIKUNJ's answer is correct, it fixed the issue for me. I ran into this problem while upgrading from spring 2.x to spring 3. Not sure why the mismatched mapping of string to an xml column worked before, but the upgrade definitely started causing these: org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update –  depsypher Jan 14 '13 at 20:39

3 Answers 3

You have to specify your custom column type using org.hibernate.usertype.UserType class provided by hibernate.

Here is very good example.


share|improve this answer

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

share|improve this answer
I have tried that , but still it was showing same Error. –  lakshmi Jul 22 '11 at 4:32

Use addSclar();

For example

session.createSQLQuery("select public.flcpool_backup()")
                                     .addScalar("id", Hibernate.BIG_INTEGER)
                                     .addScalar("caf_tbl_id", Hibernate.BIG_INTEGER)
share|improve this answer

Your Answer


