Announcement Announcement Module
Collapse
No announcement yet.
Exception:Result object returned from HibernateCallback isn't a List Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exception:Result object returned from HibernateCallback isn't a List

    When i try to use executeFind() on the HibernateCallback, i get the below exceptions...i looked at the executeFind() code and it is always trying to look for List obj...is this a bug or i am doing something wrong

    Hibernate: 2.2.8
    Spring : 2.0.6

    tx in advance

    Code:
    public Scenario getScenarioByContextualId(final Long contextualId, final Filterable filterable)
    {
    	return (Scenario) getHibernateTemplate().executeFind(new HibernateCallback()
    	{
    		public Object doInHibernate(final Session session) throws HibernateException, SQLException
    		{
    			Query query = session.getNamedQuery(QRY_FIND_SCENARIO_BY_CONTEXTUAL_ID_WITHIN_CLIENT_AND_SYSTEM);
    			query.setParameter(CONTEXTUAL_ID, contextualId);
    			query.setParameter(SYSTEM_CODE, filterable.getSystemCode());
    			query.setParameter(CLIENT_CODE, filterable.getClientCode());
    
    		return query.uniqueResult();
    		}
    	});
    }

    StackTrace
    org.springframework.dao.InvalidDataAccessApiUsageE xception: Result object returned from HibernateCallback isn't a List: [com.equifax.ic.tdp.framework.catalog.dao.BasicScen ario@4e644e64]
    at org.springframework.orm.hibernate.HibernateTemplat e.executeFind(HibernateTemplate.java:342)
    at com.equifax.ic.tdp.dao.HibernateScenarioDao.getSce narioByContextualId(HibernateScenarioDao.java:111)
    at com.equifax.ic.tdp.dao.utest.HibernateScenarioDaoT est.testGetScenarioByContextualId(HibernateScenari oDaoTest.java:63)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:64)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:615)
    at junit.framework.TestCase.runTest(TestCase.java:154 )
    at junit.framework.TestCase.runBare(TestCase.java:127 )
    at junit.framework.TestResult$1.protect(TestResult.ja va:106)
    at junit.framework.TestResult.runProtected(TestResult .java:124)
    at junit.framework.TestResult.run(TestResult.java:109 )
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:2 08)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at org.junit.internal.runners.OldTestClassRunner.run( OldTestClassRunner.java:35)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestR eference.run(JUnit4TestReference.java:38)
    at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:196)

  • #2
    Ok the problem is that for executeFind() the return type is List....so there is no way to use uniqueResult() within the callback from executeFind()...may be we should use execute()

    Comment


    • #3
      Could not synchronize database state with sessionorg.hibernate.exception.ConstraintVi

      Could not synchronize database state with sessionorg.hibernate.exception.ConstraintViolation Exception: Could not execute JDBC batch update

      Comment

      Working...
      X