ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Naijatek" <sharda...@gmail.com>
Subject RE: Problem with maps
Date Fri, 05 May 2006 15:15:27 GMT
Try this

And this is if you are using the Fondos Value Object as the parameter.
------------------
<?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 name="Fondos">
	<typeAlias alias="FondosVO"
type="org.jl.meroden.listados.fondos.Fondos"/>

       <resultMap class="FondosResult" id="fondos-result" >
               <result property="fondoCodigo" column="E01FON" />
               <result property="fondoNombre" column="E01NBR" />
   </resultMap>

       <select id="selectFondos"
         resultClass="FondosResult"
         resultMap="FondosVO">
       <![CDATA[
               select
               E01FON as fondoCodigo,
               E01NBR as fondoNombre,
               from E01PI
               where E01PI.E01FBA <> 0
   ]]>
       </select>

</sqlMap>

-----Original Message-----
From: Javier Leyba [mailto:xleyba@gmail.com] 
Sent: Friday, May 05, 2006 3:09 AM
To: user-java@ibatis.apache.org
Subject: Problem with maps

Hi

I'm new with Ibatis.

I did a map config like this:

-------------------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE sqlMapConfig
 PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
 "http://www.ibatis.com/dtd/sql-map-config-2.dtd">

<sqlMapConfig>

 <properties resource="xxx.properties" />

 <settings
   cacheModelsEnabled="true"
   enhancementEnabled="true"
   maxSessions="64"
   maxTransactions="8"
   maxRequests="128"/>

 <transactionManager type="JDBC">
   <dataSource type="SIMPLE">
     <property value="${driver}" name="JDBC.Driver"/>
     <property value="${url}" name="JDBC.ConnectionURL"/>
     <property value="${username}" name="JDBC.Username"/>
     <property value="${password}" name="JDBC.Password"/>
     <property value="15" name="Pool.MaximumActiveConnections"/>
     <property value="15" name="Pool.MaximumIdleConnections"/>
     <property value="1000" name="Pool.MaximumWait"/>
   </dataSource>
 </transactionManager>

 <sqlMap resource="Fondos.xml"/>

</sqlMapConfig>
-----------------------------



and then I did sqlmap like this:


------------------
<?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 name="Fondos">

       <resultMap class="" id="fondos-result" >
               <result property="fondoCodigo" column="E01FON" />
               <result property="fondoNombre" column="E01NBR" />
   </resultMap>

       <select id="selectFondos"
         resultClass="org.jl.meroden.listados.fondos.Fondos"
         resultMap="fondos-result">
       <![CDATA[
               select
               E01FON as fondoCodigo,
               E01NBR as fondoNombre,
               from E01PI
               where E01PI.E01FBA <> 0
   ]]>
       </select>

</sqlMap>
-----------------------------



When I run my application I get an Exception that say:


Caused by: com.ibatis.common.exception.NestedRuntimeException: Error
configuring Result.  Could not set ResultClass.  Cause:
java.lang.ClassNotFoundException:
Caused by: java.lang.ClassNotFoundException:
       at
com.ibatis.sqlmap.engine.builder.xml.SqlMapParser$14.process(SqlMapParser.ja
va:338)
       at
com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:112)
       ... 17 more
Caused by: java.lang.ClassNotFoundException:
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Unknown Source)
       at
com.ibatis.common.resources.Resources.classForName(Resources.java:244)
       at
com.ibatis.sqlmap.engine.builder.xml.SqlMapParser$14.process(SqlMapParser.ja
va:336)
       ... 18 more

Caused by:
com.ibatis.common.exception.NestedRuntimeException: Error configuring
Result.  Could not set ResultClass.  Cause:
java.lang.ClassNotFoundException:
Caused by: java.lang.ClassNotFoundException:
       at
com.ibatis.sqlmap.engine.builder.xml.SqlMapParser$14.process(SqlMapParser.ja
va:338)
       at
com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:112)
       at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:75)
       at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:93)
       at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:63)
       at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:51)
       at
com.ibatis.sqlmap.engine.builder.xml.SqlMapParser.parse(SqlMapParser.java:45
)
       at
com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$11.process(SqlMapCon
figParser.java:347)
       at
com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:112)
       at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:75)
       at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:93)
       at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:63)
       at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:51)
       at
com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigPa
rser.java:78)
       at
com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientB
uilder.java:62)
       at org.jl.meriden.listados.MySqlMap.<clinit>(MySqlMap.java:27)
       at
org.jl.meriden.listados.saldos.participes.SaldosParticipeReport.<init>(Saldo
sParticipeReport.java:25)
       at org.jl.meriden.listados.Application.<init>(Application.java:21)
       at org.jl.meriden.listados.Application.main(Application.java:25)
Caused by: java.lang.ClassNotFoundException:
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Unknown Source)
       at
com.ibatis.common.resources.Resources.classForName(Resources.java:244)
       at
com.ibatis.sqlmap.engine.builder.xml.SqlMapParser$14.process(SqlMapParser.ja
va:336)
       ... 18 more


---------------


Why this error and how could I solve it ?

Thanks in advance.


--
Javier Leyba
Barcelona - Spain
http://blog.leyba.com.ar


Mime
View raw message