If you read carefully, you'll see that there is no WRITEABLE property named "Firstname" in
class "com.domain.User"
This means that your com.domain.User class doesn't have a "setFirstname" method.
Also, the property should be start with lowercase, e.g. "firstname".
________________________________
From: Okan Çetin [mailto:okancetin@gmail.com]
Sent: Friday, September 08, 2006 11:13 AM
To: user-java@ibatis.apache.org
Subject: xml parser errors
Hi all;
I'm getting some XML Parser exceptions. But the xml files look like correct. Where is my
fault?
java.lang.RuntimeException : Error occurred. Cause: com.ibatis.common.xml.NodeletException:
Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'.
Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException:
Error parsing XPath '/sqlMap/resultMap/result'. Cause: com.ibatis.common.beans.ProbeException:
There is no WRITEABLE property named 'Firstname' in class 'com.domain.User'
1) SqlMapConfig.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<!-- Configure a built-in transaction manager. If you're using an
app server, you probably want to use its transaction manager
and a managed datasource -->
<transactionManager type="JDBC" commitRequired="false">
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value=" org.postgresql.Driver"/>
<property name="JDBC.ConnectionURL" value="jdbc:postgresql:."/>
<property name="JDBC.Username" value="postgres"/>
<property name=" JDBC.Password" value="159753"/>
</dataSource>
</transactionManager>
<!-- List the SQL Map XML files. They can be loaded from the
classpath, as they are here (com.domain.data...) -->
<sqlMap resource="com/data/User.xml"/>
<!-- List more here...
<sqlMap resource="com/mydomain/data/Order.xml"/>
<sqlMap resource="com/mydomain/data/Documents.xml"/>
-->
</sqlMapConfig>
2) User.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="User">
<!-- Use type aliases to avoid typing the full classname every time. -->
<typeAlias alias="User" type="com.domain.User"/>
<!-- Result maps describe the mapping between the columns returned
from a query, and the class properties. A result map isn't
necessary if the columns (or aliases) match to the properties
exactly. -->
<resultMap id="UserResult" class="User">
<result property="Firstname" column="firstname"/>
</resultMap>
<!-- Select with no parameters using the result map for Account class. -->
<select id="selectAllUsers" resultMap="UserResult">
select * from user
</select>
</sqlMap>
Thanks;
Okan.
--
~
otomatik olu?turuldu:
http://ocetin.net/log
http://linux.beykent.edu.tr
|