java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer

GitHub | goeh | 8 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    ClassCastException when using unique constraint on multiple columns

    GitHub | 8 months ago | goeh
    java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
  2. 0

    Implement sql 'like' in criteria. Hibernate

    Stack Overflow | 5 years ago | Divers
    java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long

  1. tfr 1 times, last 9 months ago
2 unregistered visitors

Root Cause Analysis

  1. java.lang.ClassCastException

    java.lang.Long cannot be cast to java.lang.Integer

    at org.hibernate.type.descriptor.java.IntegerTypeDescriptor.unwrap()
  2. Hibernate
    CriteriaImpl.uniqueResult
    1. org.hibernate.type.descriptor.java.IntegerTypeDescriptor.unwrap(IntegerTypeDescriptor.java:19)
    2. org.hibernate.type.descriptor.sql.IntegerTypeDescriptor$1.doBind(IntegerTypeDescriptor.java:46)
    3. org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:74)
    4. org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:253)
    5. org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:248)
    6. org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:2044)
    7. org.hibernate.loader.Loader.bindParameterValues(Loader.java:2013)
    8. org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1943)
    9. org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1896)
    10. org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1874)
    11. org.hibernate.loader.Loader.doQuery(Loader.java:919)
    12. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336)
    13. org.hibernate.loader.Loader.doList(Loader.java:2610)
    14. org.hibernate.loader.Loader.doList(Loader.java:2593)
    15. org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2422)
    16. org.hibernate.loader.Loader.list(Loader.java:2417)
    17. org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:109)
    18. org.hibernate.internal.SessionImpl.list(SessionImpl.java:1787)
    19. org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:363)
    20. org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:385)
    20 frames
  3. Grails GORM
    HibernateCriteriaBuilder.executeUniqueResultWithProxyUnwrap
    1. grails.orm.HibernateCriteriaBuilder.executeUniqueResultWithProxyUnwrap(HibernateCriteriaBuilder.java:144)
    1 frame