[hibernate-issues] [Hibernate-JIRA] Updated: (ANN-696) @Type with Maps from Element to Element applies to both key to value type.

Emmanuel Bernard (JIRA) noreply at atlassian.com
Mon Mar 10 23:10:33 EDT 2008


     [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-696?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Bernard updated ANN-696:
---------------------------------

    Fix Version/s: 3.3.1

not sure about 3.3.1, will try though

> @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
>             Fix For: 3.3.1
>
>         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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list