ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nuno Rodrigues" <confusionval...@netcabo.pt>
Subject RE: IBATIS strange problem
Date Tue, 24 Apr 2007 12:21:40 GMT
Sorry … When I said jpetstore.PRODUCTS it was jpetstore.ITEM and
jpetstore.CATEGORY. 

 

Nuno

 

  _____  

From: Nuno Rodrigues [mailto:confusionvalley@netcabo.pt] 
Sent: terça-feira, 24 de Abril de 2007 13:17
To: user-java@ibatis.apache.org
Subject: IBATIS strange problem

 

Hello all,

 

I guess that there’s a bug in IBATIS but I really don’t know where… errr. 

 

These were the steps where I caught the problem: 

 

Configure JPetstore 5 to work in linux + apache tomcat 5.5.20 + MySQL. ( I
have configured it in Windows ant it worked nice ) 

 

Open the jpetstore main webpage and click on a category to open the
viewCategory page. 

 

An error will be shown because it can’t find the table names. In my case it
was jpetstore.PRODUCTS… This happened because of the Linux case sensitive
issue.

 

Change the
jpetstore/WEB-INF/classes/com/ibatis/jpetstore/persistence/sqlmapdao/sql/*.x
ml files and UPPER CASE the table names.

 

Restart tomcat, Re-deploy Jpetstore and Go to the viewCategory page again.

 

>From here I started getting the error: “org.apache.jasper.JasperException:
Define tag cannot set a null value”
 

I thought that probably the #categoryid# variable wasn’t being filled
correctly and I changed the
jpetstore/WEB-INF/classes/com/ibatis/jpetstore/persistence/sqlmapdao/sql/Cat
egory.xml file. 

In this file I’ve changed 

 

 

  <select id="getCategory" resultClass="category" parameterClass="string"
cache$

    SELECT

      CATID AS categoryId,

      NAME,

      DESCN AS description

    FROM category

    WHERE CATID = #categoryid#

  </select>

 

By

 

 

  <select id="getCategory" resultClass="category" parameterClass="string"
cache$

    SELECT

      CATID AS categoryId,

      NAME,

      DESCN AS description

    FROM category

    WHERE CATID = ‘FISH’

  </select>

 

Notice that I changed #categoryid# by ‘FISH’

 

At this time the page opens but it doesn’t show any products.

 

Ok, if the problem was in the  #categoryid# parameter I thought that I
should trace the value of this variable. In the JPetstore source code I’ve
included a System.out.println(“”+categoryId) in the getCategory(String
categoryId) method in the
com/ibatis/jpetstore/persistence/sqlmapdao/CategorySqlMapDao.java file.

 

I have run the application again and I’ve seen that the variable categoryId
was correct when the CategorySqlMapDao is executed.

 

This makes me think that the problem only could be in the Ibatis Framework
since that in the application the variable categoryId is shown correctly but
when it is used in the SQL query defined in the XML file it is a null
variable.

 

Hope to hear some answer from you.

 

Cheers, 

Nuno

 

 

 

 


Mime
View raw message