ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fabio bongiovanni <fabio.bongiova...@taipan.it>
Subject Problem Using Discriminator Tag
Date Tue, 27 Sep 2005 11:24:22 GMT
Hello and thanks in advice

I'm using ibatis java 2.1.5.

I've found in the mail-archive a link to a map example that use 
discriminator tag inside a resulMap
The file is named Documents.xml

I've tried to build an example over this map, but i'm getting errors 
during the building of daoManager
The error is :

13:21:39,643 INFO  [STDOUT] com.ibatis.dao.client.DaoException: Error 
while configuring DaoManager.  Cause: 
com.ibatis.sqlmap.client.SqlMapException: There was an error while 
building the SqlMap instance. 
--- The error occurred in 
com/taipan/monitor/persistence/sql/Documents.xml. 
--- The error occurred while building a result map. 
--- Check the null mapping of the Documents.document result map. 
--- Check the result mapping property type or name. 
--- Cause: java.lang.NullPointerException
Caused by: java.lang.NullPointerException
Caused by: com.ibatis.sqlmap.client.SqlMapException: There was an error 
while building the SqlMap instance. 
--- The error occurred in 
com/taipan/monitor/persistence/sql/Documents.xml. 
--- The error occurred while building a result map. 
--- Check the null mapping of the Documents.document result map. 
--- Check the result mapping property type or name. 
--- Cause: java.lang.NullPointerException
Caused by: java.lang.NullPointerException
13:21:39,653 INFO  [STDOUT]     at 
com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder.buildDaoManager(XmlDaoManagerBuilder.java:112)
13:21:39,663 INFO  [STDOUT]     at 
com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder.buildDaoManager(XmlDaoManagerBuilder.java:66)
13:21:39,663 INFO  [STDOUT]     at 
com.ibatis.dao.client.DaoManagerBuilder.buildDaoManager(DaoManagerBuilder.java:37)
13:21:39,663 INFO  [STDOUT]     at 
com.taipan.monitor.domain.logic.MonitorLogic.initDaoManager(MonitorLogic.java:35)
13:21:39,663 INFO  [STDOUT]     at 
com.taipan.monitor.domain.logic.MonitorLogic.<clinit>(MonitorLogic.java:27)
13:21:39,663 INFO  [STDOUT]     at 
com.taipan.monitor.service.CambioLavoroService.<init>(CambioLavoroService.java:48)
13:21:39,663 INFO  [STDOUT]     at 
com.taipan.monitor.service.CambioLavoroService.<clinit>(CambioLavoroService.java:32)
13:21:39,663 INFO  [STDOUT]     at 
com.taipan.monitor.presentation.action.ListaMacchineAction.<clinit>(ListaMacchineAction.java:27)
13:21:39,663 INFO  [STDOUT]     at 
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
13:21:39,663 INFO  [STDOUT]     at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
13:21:39,663 INFO  [STDOUT]     at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
13:21:39,663 INFO  [STDOUT]     at 
java.lang.reflect.Constructor.newInstance(Constructor.java:274)
13:21:39,663 INFO  [STDOUT]     at 
java.lang.Class.newInstance0(Class.java:308)
13:21:39,663 INFO  [STDOUT]     at 
java.lang.Class.newInstance(Class.java:261)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:143)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:280)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:218)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
13:21:39,663 INFO  [STDOUT]     at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
13:21:39,663 INFO  [STDOUT]     at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
13:21:39,663 INFO  [STDOUT]     at 
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
13:21:39,663 INFO  [STDOUT]     at 
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
13:21:39,663 INFO  [STDOUT]     at 
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
13:21:39,663 INFO  [STDOUT]     at 
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
13:21:39,663 INFO  [STDOUT]     at 
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
13:21:39,663 INFO  [STDOUT]     at java.lang.Thread.run(Thread.java:534)

THe xml map file is:

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

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

<sqlMap namespace="Documents">
<resultMap id="document" class="testdomain.Document">
    <result property="id" column="DOCUMENT_ID"/>
    <result property="title" column="DOCUMENT_TITLE"/>
    <result property="type" column="DOCUMENT_TYPE"/>
    <discriminator column="DOCUMENT_TYPE" javaType="string" >
      <subMap value="Book" resultMap="book"/>
      <subMap value="Newspaper" resultMap="news"/>
    </discriminator>
  </resultMap>

  <resultMap id="book" class="testdomain.Book" extends="document">
    <result property="pages" column="DOCUMENT_PAGENUMBER"/>
  </resultMap>

  <resultMap id="news" class="testdomain.Magazine" extends="document">
    <result property="city" column="DOCUMENT_CITY"/>
  </resultMap>

  <select id="getDocuments" resultMap="document">
    select * from DOCUMENTS
  </select>

  <select id="getDocument" parameterClass="int" resultMap="document">
    select * from DOCUMENTS where DOCUMENT_ID = #id#
  </select>

  <insert id="insertDocument" parameterClass="testdomain.Document">
    insert into DOCUMENTS (DOCUMENT_ID, DOCUMENT_TITLE, DOCUMENT_TYPE) 
values (#id#, #title#, #type#)
  </insert>

  <update id="updateDocument" parameterClass="testdomain.Document">
    update DOCUMENTS set DOCUMENT_TITLE = #title#, DOCUMENT_TYPE = 
#type# where DOCUMENT_ID = #id#
  </update>

  <delete id="deleteDocument" parameterClass="testdomain.Document">
    delete from DOCUMENTS where DOCUMENT_ID = #id#
  </delete>

</sqlMap>

Any help is appreciated
Regards

Fabio Bongiovanni

Mime
View raw message