Skip to main content

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

Hi James,

The code where it works and where it fails is exactly the same.  The
offending line (with associated logging) is from the predicate object:"calling addAuxVerbs, index: " + verbFormIndex);"verbForm: " + verbForms.get(verbFormIndex));"class: " + verbForms.get(verbFormIndex).getClass());
    	addAuxVerbs(sentence, sentencePredicate, verbForms.get(verbFormIndex));"no cast issues w/addAuxVerbs");

And here is a portion of the predicate object definition:

public class Predicate implements Serializable {

    @GeneratedValue(strategy = GenerationType.TABLE, generator =
    private Long itemID;
    private String name;
    private SentenceGroup sentenceGroup;
    private PredicatePattern pattern = PredicatePattern.CLAUSE_VI;
    private Verb verb1;
    private Verb verb2;
    private List<VerbForm> verbForms;

etc. ......

The logs that are generated in the successful case are:

addAuxVerbs, index: 0|#]


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

cast issues w/addAuxVerbs|#]

Then in the failed case, the logs are:


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


The particular predicate object that I'm accessing is the same in both the
successful and failed cases and the verbForms list is not updated between
the two accesses.  The logs show that the index it is using is the same in
both cases and the value of the particular verbForm is the same, but when I
try to access the class, I get the error.  (Note that when the logging stmt
is removed, I get this same error at the addAuxVerbs line).

I know that the system initially sees the verbForm list as being a list of
VerbForm enums from this log:

target class (reference) class for the element collection mapping element
[field verbForms] is being defaulted to: class

I hope this is enough info to demonstrate the problem.  I'm happy to do
whatever else I can to narrow down the underlying issue, but I just don't
know what else to look at.


James Sutherland wrote:
> I don't seem to be able to see you attachments.  Perhaps inline them, or
> provide a link.
> Also include the code for the classes where it works, and where it does
> not.

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

Back to the top