Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] enum access cast issue


I'm using Glassfish v3 w/EclipseLink and have an entity with a list of enums
defined as:

private List<VerbForm> verbForms;

I can access the verbForms in many cases with no problems, but in one
particular case where this entity is nested within other entities, when I
try to reference it, I get a cast error.

Here is a log from a normal/good case with my debug info showing that it is
accessed as the correct enum class:

addAuxVerbs, index: 0|#]


class com.leadingstep.grammardb.verbs.VerbForm|#]

cast issues w/addAuxVerbs|#]


And here is the log when the problem occurs:

addAuxVerbs, index: 0|#]


system exception occurred during an invocation on EJB GrammarDBBean method
public java.util.List


Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to


I can include more of the error message if it would be helpful, but I'm
really at a loss to understand how JPA can access the field and correctly
interpret it as an Enum class in one instance, but then access the same
field at the same point in code later and think it is a String that needs to
be converted?  This same entity is embedded indirectly in four other
different entities and I can access it correctly in three out of four of
those cases.  I can't begin to imagine what could be different in the way
it's accessed that would cause this problem.

I had been using the EclipseLink 1.1.2 - Galileo library, but upgraded to
EclipseLink 2.0.1 and that didn't help or change anything.  I'm running on a
Mac with GlassFish Tools Bundle for Eclipse, v1.2.

Can anyone give me some clues as to what might be going on and how I can
resolve this issue?

Thanks so much,

View this message in context:
Sent from the EclipseLink - Users mailing list archive at

Back to the top