• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

iBatis SQLMap

 
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am new to iBatis. Can someone please tell me what the bolded ones do in the below example?

1).
<sqlMap>

<resultMap id="map1" class="com.xyz.Messages">
<result property="fileName" column="FILE_NAME"/>
<result property="title" column="TITLE"/>
</resultMap>

<select id="getMessages" parameterClass="java.lang.String" resultMap="map1">
some select query
</select>

<sqlMap>

What is map1? Does the query result get stored in a map something? How do I view it or retrieve it? When I did search file for map1 (Took map1 here as an example) on Eclipse in my entire source code, I am unable to find it.

2). getSqlMapClientTemplate().queryForList(getMessages, key);

I know that the getMessages is the query name and using which a particular query is identified. But how is the key used? Can someone give a simple example?

Thanks
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, For the first question, From what I read, resultMap is the one used to map our class's instance variables to the database columns. I used to think that the resultset values from executing the query will be stored in a map something. which is wrong.

For the second question,
key is used in the where clause of the query statement.

Please correct me if I am wrong.

Thanks.



 
Opportunity is missed by most people because it is dressed in overalls and looks like work - Edison. Tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic