[hibernate-dev] Enum mapping in hbm.xml
Steve Ebersole
steve at hibernate.org
Mon Jul 20 13:36:30 EDT 2015
https://hibernate.atlassian.net/browse/HHH-9955
On Mon, Jul 20, 2015 at 12:05 PM Steve Ebersole <steve at hibernate.org> wrote:
> Well, first things first :)
>
> Does anyone disagree with making this a requirement to be fully expressed
> in the mapping? In other words, does anyone disagree fully resolving the
> "enum type" (ordinal/name)
> in org.hibernate.type.EnumType#setParameterValues?
>
> This would mean getting rid of the hooks in nullSafeSet/nullSafeGet as
> they would be pointless.
>
> As far as the default type, I don't feel that strongly. Like I said, to
> me neither is a really compelling way to map enums; names are only slightly
> better that ordinals imo. I am ok with the consistency aspect.
>
>
> On Mon, Jul 20, 2015 at 2:25 AM Emmanuel Bernard <emmanuel at hibernate.org>
> wrote:
>
>>
>> On 19 Jul 2015, at 16:53, Steve Ebersole <steve at hibernate.org> wrote:
>>
>> What I propose is that we change this. I am kind of torn as to the
>> default
>> tbh. I think JPA's default of ORDINAL is the wrong choice. I think NAMED
>> is the better choice. Well technically I think an independent mapping
>> code
>> it best. But strictly between ORDINAL/NAMED, I think NAMED is better. So
>> if everyone agrees that we change this to definitively determine the enum
>> mapping up front, which style do we choose as the default. Obviously the
>> big argument for choosing ORDINAL is consistency with annotations.
>>
>>
>> Even if like you I prefer NAMED over ORDINAL, I would prefer consistency
>> with annotations. If you feel strongly on the subject, I think the other
>> way is fine too since:
>>
>> * the recommendation is to be explicit
>> * hbm is already quite a different beast than annotations/orm.xml
>>
>>
More information about the hibernate-dev
mailing list