Hello,
I am facing following problem. I have an entity that contains boolean field. In MySQL I define this field as bit(1) (in older versions of hibernate, boolean was mapped to bit(1) in mysql). With Hibernate 4 however, it throws following
Quote:
exception:
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1786)
at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_22]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_22]
at java.lang.Thread.run(Thread.java:680) [:1.6.0_22]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: UNIT1] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:903)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:879)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.jboss.as.jpa.service.PersistenceUnitService.createContainerEntityManagerFactory(PersistenceUnitService.java:170)
at org.jboss.as.jpa.service.PersistenceUnitService.start(PersistenceUnitService.java:80)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
... 4 more
Caused by: org.hibernate.HibernateException: Wrong column type in blah.person for column locked. Found: bit, expected: boolean
at org.hibernate.mapping.Table.validateColumns(Table.java:281)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1264)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:449)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1720)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:77)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:894)
... 9 more
boolean in mysql is mapped to tinyint(1) but it returns the same result. Note that I specify validation of a scheme in persistence.xml as follows:
Quote:
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect" />
<property name="hibernate.hbm2ddl.auto" value="validate"/>
Any suggestions?
Thanks