No Dialect mapping for JDBC type: 1899073220 in Wildfly (AttributeConverter and Short)

Description

I use AttributeConverter(

) to convert enum value(

). It run perfect normal when use "Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME)"(

) to initialize the JPA runtime. But when I deploy it into WildFly as a EJB(

), the JPA runtime initialization failed with the following exception:

Caused by: javax.persistence.PersistenceException: [PersistenceUnit: SensorNetwork] Unable to build Hibernate SessionFactory
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:953)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:883)
at org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:167)
... 7 more
Caused by: org.hibernate.MappingException: No Dialect mapping for JDBC type: 1899073220
at org.hibernate.dialect.TypeNames.get(TypeNames.java:70)
at org.hibernate.dialect.TypeNames.get(TypeNames.java:101)
at org.hibernate.dialect.Dialect.getTypeName(Dialect.java:342)
at org.hibernate.spatial.dialect.mysql.MySQL56SpatialDialect.getTypeName(MySQL56SpatialDialect.java:75)
at org.hibernate.mapping.Column.getSqlType(Column.java:231)
at org.hibernate.tool.schema.internal.AbstractSchemaValidator.validateColumnType(AbstractSchemaValidator.java:156)
at org.hibernate.tool.schema.internal.AbstractSchemaValidator.validateTable(AbstractSchemaValidator.java:143)
at org.hibernate.tool.schema.internal.GroupedSchemaValidatorImpl.validateTables(GroupedSchemaValidatorImpl.java:42)
at org.hibernate.tool.schema.internal.AbstractSchemaValidator.performValidation(AbstractSchemaValidator.java:89)
at org.hibernate.tool.schema.internal.AbstractSchemaValidator.doValidation(AbstractSchemaValidator.java:68)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:184)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:65)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:476)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:422)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:880)

In the Full log of Wildfly:

, i notice the following infomation:

2017-11-22 15:02:25,396 DEBUG [org.hibernate.cfg.annotations.SimpleValueBinder] (ServerService Thread Pool – 13) Starting fillSimpleValue for connectionState
2017-11-22 15:02:25,396 DEBUG [org.hibernate.cfg.annotations.SimpleValueBinder] (ServerService Thread Pool – 13) Applying JPA AttributeConverter [org.hibernate.boot.internal.AttributeConverterDescriptorImpl@1e0c7d11] to [com.tekview.transview.sensornetwork.model.Lamppost:connectionState]
2017-11-22 15:02:25,396 DEBUG [org.hibernate.type.descriptor.sql.JdbcTypeJavaClassMappings] (ServerService Thread Pool – 13) JDBC type code mapping not known for class [java.lang.Short]; using custom code [1899073220]
2017-11-22 15:02:25,396 DEBUG [org.hibernate.type.descriptor.converter.AttributeConverterTypeAdapter] (ServerService Thread Pool – 13) Created AttributeConverterTypeAdapter -> converted::com.tekview.transview.sensornetwork.persist.converter.ConnectionStateConverter

When I refactor my code ConnectionStateConverter with the new one:
public class ConnectionStateConverter implements AttributeConverter<ConnectionState, Integer>, everything goes ok.

Why?

Environment

java.version: 1.8.0_73
java.vm.vendor: Oracle Corporation
java.vm.version: 25.73-b02
os.name: Windows 8
os.version: 6.2
wildfly.version: 11.0.0.Final
hibernate.version: 5.1.10.Final
mysql.version: 5.6.25-log
mysql.connector.java.version 5.1.44

Activity

Show:
Gregoire Job
December 10, 2018, 3:39 PM

The association of Bytes.class and Types.TINYINT is missed in version 5.2.13 and is necessary in 5.1.10 used by JBoss EAP 7.1. We lost the benefit of secured version of JBoss EAP if we upgrade manually the hibernate version used.

Vlad Mihalcea
December 6, 2018, 9:55 AM

This was fixed in 5.2.13. Tru to upgrade the Hibernate ORM version and it should work.

Gregoire Job
December 6, 2018, 9:43 AM

it seems we have the same probleme in JBoss EAP 7.1 (Hibernate 5.1.10.Final-redhat-1) for Byte that the declaration is missed in the class JdbcTypeJavaClassMappings

Vlad Mihalcea
November 27, 2017, 3:11 PM

Applied PR upstream along with a new test case that replicates the original issue.

Tiger Wang
November 27, 2017, 2:36 AM

Hi Steve, new PR(https://github.com/hibernate/hibernate-orm/pull/2067) has been committed.

Fixed

Assignee

Steve Ebersole

Reporter

Tiger Wang

Fix versions