|
We just discovered exactly this problem, too (with mysql and both Hibernate 4.2.0.Final and within Jboss EAP 6.1.0 with contained Hibernate 'hibernate-core-4.2.0.Final-redhat-1.jar') . As the fixing of this issue would be quite urgent to us: Is there any chance that this is going to be solved soon? Is there a known workaround? The obvious workaround to use ordinals for enums is no option for us, we want the literal values of enums to be saved in the database.
More detailed error description (at least as far i understand it): The problem occurs when trying to resolve the enum mapper in EnumType.resolveEnumValueMapper while trying to save an enum value. There the expression 'rs.getMetaData().getColumnType( rs.findColumn( name ) ) ' leads to the exception 'java.sql.SQLException: Parameter metadata not available for the given statement', and so the fallback strategy is being used, which saves the given enum value as ordinal in the database. But, when trying to load the same value from database, the value is resolved correctly (to 12) and therefore the correct enum mapper is being used - which then tries to interpret the given ordinal as a literal, which (obviously) fails.
In JBoss it happens exactly the other way round (a literal was saved in the database but the EnumMapper tries to read a ordinal value from the database when reading the enum value).
|