[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-657) @Enumerated(value=EnumType.STRING) for Maps (java.util.EnumMap) ?

Nicolas Berthet (JIRA) noreply at atlassian.com
Fri Aug 22 08:50:50 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_30980 ] 

Nicolas Berthet commented on ANN-657:
-------------------------------------

Hello,

I had the same using an ORDINAL as a @ManyToMany map key. Using hibernate tools, the column was declared as a bytea (pgsql).

The workaround I found is to manually map the key, it should be fairly doable for STRINGs too...

@MapKey(columns = @Column(name = "my_column_name", nullable = false), type=@Type(type="org.hibernate.type.EnumType",parameters={@org.hibernate.annotations.Parameter(name="enumClass",value="my.enum.class.Name")}))
	
Anyway, it would be nice to get an annotation to fit this requirements as it was the case in the old version :)

> @Enumerated(value=EnumType.STRING) for Maps (java.util.EnumMap) ?
> -----------------------------------------------------------------
>
>                 Key: ANN-657
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-657
>             Project: Hibernate Annotations
>          Issue Type: Improvement
>    Affects Versions: 3.3.0.ga
>         Environment: hibernate 3.2.4.sp1; PostgresSql 8.2
>            Reporter: Michael Grünewald
>            Priority: Minor
>
> Hi, 
> I faced the problem, that I can't enforce a String-Mapping for an enum type key of an Map.
> E.g.:
> Map<? extends Enum<?>, String> 
> I would suppose to use an attribute for @MapKey to do that.
> E.g.: @MapKey (enumerated=EnumType.STRING)
> Please read the forum entry for  more informations.
> http://forum.hibernate.org/viewtopic.php?t=97827
> Greetings Michael

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