Mapping enum types for DB with Sun Application Server.

My entity bean uses an enum type the next way:

@ Entity

publicclass SomeoneEntityBeanimplements Serializable

{

private MyEnumType myEnumType;

@ Enumerated(EnumType.STRING)

public MyEnumType getMyEnumType()

{

return myEnumType;

}

publicvoid setMyEnumType(MyEnumType myEnumType)

{

this.myEnumType = myEnumType;

}

}

MyEnumType is just a simple enum type

publicenum MyEnumType

{

VALUE1,

VALUE2

}

Deployment goes successfully, but as soon as I try to launch client it's raising exceptions:

|WARNING|sun-appserver-pe9.0|javax.enterprise.resource.corba.ee._INITIALIZING_.rpc.encoding|_ThreadID=13;_ThreadName=p: thread-pool-1; w:4;_RequestID=d5544caa-717c-47e7-a33d-5ac928814505;|"IOP00810211: (MARSHAL) Exception from readValue on ValueHandler in CDRInputStream" org.omg.CORBA.MARSHAL:vmcid: SUN minor code: 211 completed: Maybe at com.sun.corba.ee.impl.logging.ORBUtilSystemException.valuehandlerRead Exception(ORBUtilSystemException.java:7053)

at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInput Stream_1_0.java:1016)

.........

Caused by: java.io.IOException: Mismatched serialization UIDs : Source (Rep. IDRMI:MyEnumType:3762E1FD1A6B1BE5:E4A7E329E39FE56

8) = E4A7E329E39FE568 whereas Target (Rep. ID RMI:MyEnumType:3762E1FD1A6B1BE5:579D60BA4FA7862B) = 579D60BA4FA7862B

Help to fix this bug, please!

Thanks, Straiver.

[2067 byte] By [straivera] at [2007-11-26 22:50:41]
# 1
Bug fixed after replacing enums with plain strings. But question is still opened: does Sun App Server 9.0 Persistence API implementation support enums?
straivera at 2007-7-10 12:12:04 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

Hi Straiver,

You hit the "famous" issue 193 (https://glassfish.dev.java.net/issues/show_bug.cgi?id=193). It has been fixed recently, and a work around has been put into the persistence code back in October. If you can't switch to the latest GlassFish build, or try 9.1 beta build, your only work around would be to pass a String value from the client to the server and reconstruct the enum on the server as described in issues https://glassfish.dev.java.net/issues/show_bug.cgi?id=634 and https://glassfish.dev.java.net/issues/show_bug.cgi?id=1266.

Regards,

-marina

jdcmarinaa at 2007-7-10 12:12:04 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
Thanks a lot for help, Marina!yours sincerely, Straiver
straivera at 2007-7-10 12:12:04 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...