java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Enum Query: ReadAllQuery(name="MyEntity.findEnum" referenceClass=MyEntity jpql="SELECT myEntity FROM MyEntity myEntity WHERE myEntity.myEnum = 'ENUM'")

Stack Overflow | Display Name | 4 months ago
  1. 0

    Java: Have the @Enumerated(STRING) but still get ClassCastException

    Stack Overflow | 4 months ago | Display Name
    java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Enum Query: ReadAllQuery(name="MyEntity.findEnum" referenceClass=MyEntity jpql="SELECT myEntity FROM MyEntity myEntity WHERE myEntity.myEnum = 'ENUM'")
  2. 0

    Getting ClassCastException while saving entity which has embeddable class with enumerated fields

    Stack Overflow | 5 years ago | LucianoWitt
    javax.transaction.RollbackException: ARJUNA-16053 Could not commit transaction.
  3. 0

    ClassCastException when persisting enum via Hibernate

    Stack Overflow | 4 years ago | Zhedar
    java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Enum
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    JPA (Eclipselink) ElementCollection with Enum

    Stack Overflow | 3 years ago | Tim
    java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Enum
  6. 0

    Enum Type Cast, Element Collection issue in EclipseLink

    Stack Overflow | 3 years ago | CycDemo
    java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Enum

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      java.lang.String cannot be cast to java.lang.Enum

      at org.eclipse.persistence.mappings.converters.EnumTypeConverter.convertObjectValueToDataValue()
    2. EclipseLink (non-OSGi)
      EntityManagerImpl.createNamedQuery
      1. org.eclipse.persistence.mappings.converters.EnumTypeConverter.convertObjectValueToDataValue(EnumTypeConverter.java:160)
      2. org.eclipse.persistence.mappings.foundation.AbstractDirectMapping.getFieldValue(AbstractDirectMapping.java:776)
      3. org.eclipse.persistence.internal.expressions.QueryKeyExpression.getFieldValue(QueryKeyExpression.java:420)
      4. org.eclipse.persistence.internal.expressions.ConstantExpression.printSQL(ConstantExpression.java:152)
      5. org.eclipse.persistence.expressions.ExpressionOperator.printDuo(ExpressionOperator.java:2239)
      6. org.eclipse.persistence.internal.expressions.CompoundExpression.printSQL(CompoundExpression.java:286)
      7. org.eclipse.persistence.internal.expressions.RelationExpression.printSQL(RelationExpression.java:899)
      8. org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter.translateExpression(ExpressionSQLPrinter.java:306)
      9. org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter.printExpression(ExpressionSQLPrinter.java:129)
      10. org.eclipse.persistence.internal.expressions.SQLSelectStatement.printSQL(SQLSelectStatement.java:1683)
      11. org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.printSQLSelectStatement(DatabasePlatform.java:3178)
      12. org.eclipse.persistence.platform.database.PostgreSQLPlatform.printSQLSelectStatement(PostgreSQLPlatform.java:530)
      13. org.eclipse.persistence.internal.expressions.SQLSelectStatement.buildCall(SQLSelectStatement.java:782)
      14. org.eclipse.persistence.internal.expressions.SQLSelectStatement.buildCall(SQLSelectStatement.java:792)
      15. org.eclipse.persistence.descriptors.ClassDescriptor.buildCallFromStatement(ClassDescriptor.java:813)
      16. org.eclipse.persistence.internal.queries.StatementQueryMechanism.setCallFromStatement(StatementQueryMechanism.java:390)
      17. org.eclipse.persistence.internal.queries.StatementQueryMechanism.prepareSelectAllRows(StatementQueryMechanism.java:315)
      18. org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.prepareSelectAllRows(ExpressionQueryMechanism.java:1721)
      19. org.eclipse.persistence.queries.ReadAllQuery.prepareSelectAllRows(ReadAllQuery.java:813)
      20. org.eclipse.persistence.queries.ReadAllQuery.prepare(ReadAllQuery.java:744)
      21. org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(DatabaseQuery.java:661)
      22. org.eclipse.persistence.queries.ObjectLevelReadQuery.checkPrepare(ObjectLevelReadQuery.java:901)
      23. org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(DatabaseQuery.java:613)
      24. org.eclipse.persistence.internal.jpa.QueryImpl.getDatabaseQueryInternal(QueryImpl.java:341)
      25. org.eclipse.persistence.internal.jpa.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1124)
      26. org.eclipse.persistence.internal.jpa.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1144)
      26 frames
    3. com.istvanmosonyi.dbtest
      Main.main
      1. com.istvanmosonyi.dbtest.Main.main(Main.java:29)
      1 frame