ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ren...@gmail.com
Subject trivial mapping problem
Date Sun, 11 Feb 2007 06:22:11 GMT
... I must be missing something trivial, but I don't see it. I would
appreciate your help.

I have this sqlMap:

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE sqlMap PUBLIC
  "-//iBATIS.com//DTD SQL Map 2.0//EN"
  "http://www.ibatis.com/dtd/sql-map-2.dtd">

<sqlMap namespace="Blog">
	<resultMap id="imgResult"
		class="spinetrak.photoblog.model.BlogImage">
		<result property="id" column="ID" columnIndex="1" />
		<result property="caption" column="CAPTION" columnIndex="2" />
		<result property="date" column="IMGDATE" columnIndex="3" />
		<result property="exifData" column="ID" select="getExifData" />
		<result property="categories" column="ID" select="getImageCategories" />
	</resultMap>
	<resultMap id="exifResult"
		class="spinetrak.photoblog.model.BlogExif">
		<result property="imageID" column="ID" />
		<result property="camera" column="CAMERA" />
		<result property="createDate" column="CREATEDATE" />
		<result property="focalLength" column="FOCALLENGTH" />
		<result property="aperture" column="APERTURE" />
		<result property="ISO" column="ISO" />
		<result property="exposure" column="EXPOSURE" />
		<result property="flash" column="FLASH" />
		<result property="exposureBias" column="EXPOSUREBIAS" />
	</resultMap>
...
	<select id="getExifData" resultMap="exifResult"
		parameterClass="java.lang.String">
		<![CDATA[
	   	SELECT * from BEXIF where ID = #value#
	       ]]>
	</select>
	<select id="getImage" resultMap="imgResult"
		parameterClass="spinetrak.photoblog.model.BlogImage">
		<![CDATA[
	   	select * from BIMAGES where id = #id#
	       ]]>
	</select>
...
When I execute the getImage query with iBatis, I get this NPE and a
complaint about the exifData property. Any idea what's wrong with
above sqlMap?

Thanks!

junit.framework.AssertionFailedError: SqlMapClient operation;
uncategorized SQLException for SQL []; SQL state [null]; error code
[0];
--- The error occurred in spinetrak/photoblog/model/BlogImage.xml.
--- The error occurred while applying a result map.
--- Check the Blog.imgResult.
--- Check the result mapping for the 'exifData' property.
--- Cause: java.lang.NullPointerException; nested exception is
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in spinetrak/photoblog/model/BlogImage.xml.
--- The error occurred while applying a result map.
--- Check the Blog.imgResult.
--- Check the result mapping for the 'exifData' property.
--- Cause: java.lang.NullPointerException
	at junit.framework.Assert.fail(Assert.java:47)
	at spinetrak.photoblog.EditImageTest.testFormBackingObjectNoParams(EditImageTest.java:60)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java: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:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
	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)

Mime
View raw message