[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5825) Map<EnumType, String> doesn't work

Mattias Avelin (JIRA) noreply at atlassian.com
Fri Jan 7 02:22:05 EST 2011


Map<EnumType, String> doesn't work
----------------------------------

                 Key: HHH-5825
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5825
             Project: Hibernate Core
          Issue Type: Bug
    Affects Versions: 3.6.0
         Environment: Ubuntu linux 10.10, 
OpenJDK Runtime Environment (IcedTea6 1.9.2) (6b20-1.9.2-0ubuntu2),
OpenJDK Server VM (build 19.0-b09, mixed mode)
Mysql Connector 5.1.14
            Reporter: Mattias Avelin


@ElementCollection
@MapKeyEnumerated(EnumType.STRING)
private Map<AltIdType, String> altIds = new HashMap<AltIdType, String>();

results in a error when trying to generate DB with hibernate.hbm2ddl.auto.

Stacktrace:
javax.persistence.PersistenceException: [PersistenceUnit: iwebPU] Unable to build EntityManagerFactory
        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
        at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
        at se.ngm.iweb.persistence.DB.<init>(DB.java:20)
        at se.ngm.iweb.persistence.DBTest.createDB(DBTest.java:44)
Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Map, for columns: [org.hibernate.mapping.Column(altIds)]
        at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)
        at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
        at org.hibernate.mapping.Property.isValid(Property.java:185)
        at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:440)
        at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
        at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
        at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)

When I test the same code using hibernate 3.5.1 it works!

-- 
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