[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2354) Schema validation too rigid for MySql enums

Zeljko Trogrlic (JIRA) noreply at atlassian.com
Thu Jan 11 05:36:44 EST 2007


Schema validation too rigid for MySql enums
-------------------------------------------

         Key: HHH-2354
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2354
     Project: Hibernate3
        Type: Bug

  Components: metamodel  
 Environment: jboss-seam-1.1.0.GA, MySQL 5
    Reporter: Zeljko Trogrlic


Enum column type in MySQL is handled as CHAR in their JDBC driver and should be mapped to String Java type.
However, Hibernate expects varchar(n) and fails to do the validation.

This is how DatabaseMetaData.getColumns describes it:

DATA_TYPE=1
TYPE_NAME=enum

Note that although TYPE_NAME is enum, DATA_TYPE represents CHAR.

Hibernate reports following exception:

13:49:31,397 INFO  [TableMetadata] table found: configuration.userdb_domain_acl
13:49:31,397 INFO  [TableMetadata] columns: [id, enabled, tablename, domain]
13:49:31,397 WARN  [ServiceController] Problem starting service persistence.units:ear=msmgui.ear,unitName=msmgui
javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: enabled, expected: varchar(
2)
        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:698)
        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
        at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Validation should be fixed/relaxed to avoid this problem.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list