@Type with Maps from Element to Element applies to both key to value type.
--------------------------------------------------------------------------
Key: ANN-696
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-696
Project: Hibernate Annotations
Issue Type: Bug
Components: binder
Affects Versions: 3.3.0.ga
Environment: Hibernate Annotations 3.3.0.ga, HSQLDB 1.8.0.7, JUnit 4.1
Reporter: Timon Hertli
Attachments: test.zip
Having a Hibernate map where key and value are both Elements, the @Type annotation seems
to affect both key and value type:
@CollectionOfElements
@org.hibernate.annotations.MapKey
@Type(type = "myEnumType")
private Map<MyEnumType, String> enumKey = new HashMap<MyEnumType, String>();
@Test
void testEnumKey () {
MyPc pc = new MyPc();
pc.getEnumKey().put(MyEnumType.TYPE1, "str");
session.saveOrUpdate(pc);
session.flush(); //flush throws an exception since it tries to persist the String as
"myEnumType"
}
I think the following should be the expected behaviour:
@Type should only affect the Map value type.
There should be a seperate possibility to affect the key type with an @Type annotation, as
it is the case with @Column now.
This issue came from a forum entry:
http://forum.hibernate.org/viewtopic.php?t=983577
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira