persistence@glassfish.java.net

fixing issue 634?

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Tue, 26 Sep 2006 18:57:10 -0700

Tom, Team,

This issue (https://glassfish.dev.java.net/issues/show_bug.cgi?id=634) is caused
by the problem with ORB unmarshalling rules
(https://glassfish.dev.java.net/issues/show_bug.cgi?id=193).

There seems to be an easy solution to solve this bug for TopLink users by adding
an override method to EnumTypeConverter that just returns the corresponding
value instead of looking it up (and why bother spending time on lookup in this
case?).

diff -r1.3 EnumTypeConverter.java
107a108,118
>
> /**
> * INTERNAL:
> * Convert Enum object to the data value.
> */
> public Object convertObjectValueToDataValue(Object attributeValue,
Session session) {
> Object fieldValue;
> Enum theEnum = Enum.class.cast(attributeValue);
> return (m_usesOrdinalValues)? theEnum.ordinal() : theEnum.name();
> }
>

I verified that it works correctly with the test attached to the issue in both
modes (one has been failing without the fix).

What do you think?

thanks,
-marina