java.lang.ClassCastException: org.hibernate.ejb.EntityManagerImpl cannot be cast to org.hibernate.Session

Oracle Community | ziphyre | 8 years ago
  1. 0

    Cast Exception while trying to getDelegate() from EntityManager

    Oracle Community | 8 years ago | ziphyre
    java.lang.ClassCastException: org.hibernate.ejb.EntityManagerImpl cannot be cast to org.hibernate.Session
  2. 0

    openshift still not working

    GitHub | 4 years ago | mariomoreira-ptin
    org.apache.wicket.WicketRuntimeException: Error attaching this container for rendering: [Page class = com.commafeed.frontend.pages.WelcomePage, id = 8, render count = 1]
  3. 0

    AbstractQueryImpl#guessType casts SessionImplementor session to Session but StatelessSession does not implement Session. Simple test: @Test public void testStatelessSession() throws Exception { StatelessSession statelessSession = sessionFactory.openStatelessSession(); String queryString = "Select * from Papa where partition_id = :partition"; SQLQuery query = statelessSession.createSQLQuery(queryString); PartitionImpl partition = new PartitionImpl("part02"); query.setParameter("partition", partition); assertThat(query.list().size(), is(0)); } Throws Exception: java.lang.ClassCastException: org.hibernate.internal.StatelessSessionImpl cannot be cast to org.hibernate.Session at org.hibernate.internal.AbstractQueryImpl.guessType(AbstractQueryImpl.java:553) at org.hibernate.internal.AbstractQueryImpl.guessType(AbstractQueryImpl.java:534) at org.hibernate.internal.AbstractQueryImpl.determineType(AbstractQueryImpl.java:519) at org.hibernate.internal.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:487) at de.pds.common.hibernatetest.HibernateTest.testStatelessSession(HibernateTest.java:2667) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

    Hibernate JIRA | 4 months ago | Holger Niehaus
    java.lang.ClassCastException: org.hibernate.internal.StatelessSessionImpl cannot be cast to org.hibernate.Session
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    StatelessSession being cast to Session in AbstractEntityPersister (Hibernate)

    Stack Overflow | 5 months ago | longtimer
    java.lang.ClassCastException: org.hibernate.internal.StatelessSessionImpl cannot be cast to org.hibernate.Session

    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

      org.hibernate.ejb.EntityManagerImpl cannot be cast to org.hibernate.Session

      at net.snodd.web.biz.CommentBean.getComments()
    2. net.snodd.web
      CommentBean.getComments
      1. net.snodd.web.biz.CommentBean.getComments(CommentBean.java:29)
      1 frame
    3. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    4. com.sun.enterprise
      EJBSecurityManager.runMethod
      1. com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1011)
      1 frame
    5. Security Core Classes
      SecurityUtil.invoke
      1. com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:175)
      1 frame
    6. Embedded GlassFish Web
      EJBObjectInvocationHandler.invoke
      1. com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2920)
      2. com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4011)
      3. com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:203)
      3 frames