ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Pitts" <Daniel.Pi...@cnet.com>
Subject RE: select statement problem
Date Fri, 08 Sep 2006 21:09:41 GMT
Try executing the query manually in an sql client. Do you get any results?
If not, thats your problem.
Also, make sure you're using namespaces properly.


From: Okan Çetin [mailto:okancetin@gmail.com] 
Sent: Friday, September 08, 2006 1:12 PM
To: user-java@ibatis.apache.org
Subject: select statement problem

I could not getting something from db. list object does not contain any value.  Do you have
any idea ? 
The code and xml map files:
1) Code  

            List list; 
            Reader reader = Resources.getResourceAsReader("com/data/SqlMapConfig.xml");
            SqlMapClient sqlMapper = SqlMapClientBuilder.buildSqlMapClient (reader);

2) User.xml

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

<!DOCTYPE sqlMap      
    PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"      

<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"/>

  <!-- Select with no parameters using the result map for Account class. --> 
  <select id="selectAllUsers" > 
    select firstname from PUBLIC.user


3) User.java

public class User {
      private String firstname;
      // getter, setter methods.. 

Thanks for reply.

otomatik olu?turuldu:

View raw message