Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

org.hibernate.MappingException: No Dialect mapping for JDBC type: 1111

Initial SessionFactory creation failed.org.hibernate.MappingException: No Dialect mapping for JDBC type: 1111
    27 Dec, 2012 6:38:34 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet commission threw exception
    org.hibernate.MappingException: No Dialect mapping for JDBC type: 1111
        at org.hibernate.dialect.TypeNames.get(TypeNames.java:79)
        at org.hibernate.dialect.TypeNames.get(TypeNames.java:104)
        at org.hibernate.dialect.Dialect.getTypeName(Dialect.java:347)
        at org.hibernate.mapping.Column.getSqlType(Column.java:208)
        at org.hibernate.mapping.Table.sqlCreateString(Table.java:419)
        at org.hibernate.cfg.Configuration.generateSchemaCreationScript(Configuration.java:930)
        at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:105)
        at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:383)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385)
        at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
        at com.core.commission.HibernateUtil.<clinit>(HibernateUtil.java:15)
        at com.core.commission.service.BaseCommissionService.saveRules(BaseCommissionService.java:48)
        at com.core.commission.service.BaseCommissionService.processSave(BaseCommissionService.java:22)
        at com.core.web.CommissionServlet.processRequest(CommissionServlet.java:51)
        at com.core.web.CommissionServlet.doPost(CommissionServlet.java:34)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)

I am getting above error while starting the web server. I have used enum mapping with enity class. Something like...

@Column(name = "commission_type")
        @Type(type = "com.core.commission.model.FNEnumUserType", parameters = @Parameter(name = "type", value = "com.core.commission.dto.CommissionType"))
        private CommissionType commissionType;

What is the issue, do i missed anything in configuration ? Thanks !!

like image 650
Manoj Kathiriya Avatar asked Dec 27 '12 14:12

Manoj Kathiriya


2 Answers

What the stack trace tells you is that Hibernate is in the process of initialising itself, and in particular, is executing Configuration.generateSchemaCreationScript, which goes through all your mapped tables and generates DDL for them. As part of this, it queries the existing columns and converts them into an internal Hibernate representation. It does this by calling ResultSetMetaData::getColumnType and then calling TypeNames::get with the resulting type code. The problem is that getColumnType is returning a type code of 1111, which means 'other'), and Hibernate doesn't know what to do with that.

Basically, somewhere in one of your tables is a column of a type Hibernate can't handle. If you can work out which column that is, you can start thinking about what to do about it.

like image 171
Tom Anderson Avatar answered Nov 01 '22 16:11

Tom Anderson


Try to do a trace on the db side, place some breakpoints or add some log entries in your application's code to identify what is the query that is generating this error, i.e., that is being executed right before the error occurs.

Once you get the query, try to narrow down the root cause by disassembling the statement into minor chunks and see what kind of column/variable is not supported by the dialect.

like image 1
the_marcelo_r Avatar answered Nov 01 '22 15:11

the_marcelo_r