Announcement Announcement Module
Collapse
No announcement yet.
There is no statement named x in this SqlMap Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • There is no statement named x in this SqlMap

    It claims that there is no statement named getAllDescriptorTypes but my sqlMapConfig looks like this:

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!DOCTYPE sqlMap PUBLIC "-//iBatis.com//iBatis.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
    
    <sqlMap>
    	<typeAlias type="net.bioclipse.pcm.domain.DescriptorType" alias="DescriptorType" />
    	
    	<resultMap class="DescriptorType" id="descriptorType">
    		<result property="id"   column="id" />
    		<result property="name" column="name" />
    	</resultMap>
    	
    	<select id="getAllDescriptorTypes" resultMap="descriptorType">
    	select 
    		p.id   as id,
    		d.name as name
    	from
    		DescriptorType d inner join PCMBaseObject p on
    		d.pcmBaseObject = p.id
    	</select>
    </sqlMap>
    Shouldn't it recognize the select statement? Here is the stacktrace as well:

    Code:
    com.ibatis.sqlmap.client.SqlMapException: There is no statement named getAllDescriptorTypes in this SqlMap.
    	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:293)
    	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:606)
    	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
    	at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
    	at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:268)
    	at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:193)
    	at org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:219)
    	at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:266)
    	at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:260)
    	at net.bioclipse.pcm.dao.DescriptorTypeDao.getAll(DescriptorTypeDao.java:12)
    	at net.bioclipse.pcm.dao.DescriptorTypeDaoTest.testGetAll(DescriptorTypeDaoTest.java:22)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at junit.framework.TestCase.runTest(TestCase.java:168)
    	at junit.framework.TestCase.runBare(TestCase.java:134)
    	at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
    	at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.access$001(AbstractAnnotationAwareTransactionalTests.java:47)
    	at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests$1.run(AbstractAnnotationAwareTransactionalTests.java:115)
    	at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTest(AbstractAnnotationAwareTransactionalTests.java:180)
    	at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTestTimed(AbstractAnnotationAwareTransactionalTests.java:153)
    	at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runBare(AbstractAnnotationAwareTransactionalTests.java:111)
    	at junit.framework.TestResult$1.protect(TestResult.java:110)
    	at junit.framework.TestResult.runProtected(TestResult.java:128)
    	at junit.framework.TestResult.run(TestResult.java:113)
    	at junit.framework.TestCase.run(TestCase.java:124)
    	at junit.framework.TestSuite.runTest(TestSuite.java:232)
    	at junit.framework.TestSuite.run(TestSuite.java:227)
    	at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    And the applicationContext.xml:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans>
    
    <!-- DataSource bean -->
    	<bean 
    		id="dataSource"
    	   	class="org.apache.commons.dbcp.BasicDataSource"
    	   	destroy-method="close" >
    	   	
    	   	<property name="driverClassName">
    	   		<value>com.mysql.jdbc.Driver</value>
    	   	</property>
    	   	
    	  	<property name="url">
    	   		<value>jdbc:mysql://localhost:3306/pcm</value>
    	   	</property>
    	   	<property name="username">
    	   		<value>pcm</value>
    	   	</property>
    	   	<property name="password">
    	   		<value>pcmpcm</value>
    	   	</property>
    	</bean>
    	
    	<bean 
    	 id="transactionManager"
    	 class="org.springframework.jdbc.datasource.DataSourceTransactionManager" >
    	 <property name="dataSource">
    	 	<ref local="dataSource" />
    	 </property>
      	</bean>
    
    	<bean id="sqlMapClient" 
    	      class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
    		<property name="configLocation" value="sqlMapConfig.xml" />
    		<property name="dataSource"     ref="dataSource" />
    	</bean>
    	
    	<bean id="descriptorTypeDAO" class="net.bioclipse.pcm.dao.DescriptorTypeDao" >
    		<property name="dataSource">
    			<ref local="dataSource" />
    		</property>
    		<property name="sqlMapClient">
    			<ref local="sqlMapClient" />
    		</property>
    
    	</bean>
    </beans>

  • #2
    Okey found it. I had not written any sqlMapConfig skipped straight to sqlMap. That doesn't work...

    Comment

    Working...
    X