You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by pc leung <pi...@gmail.com> on 2005/11/29 16:39:26 UTC
How to define xml of queryForObject and queryForList?
How to define xml of queryForObject and queryForList?
UserProfileSqlMapDao.java:
...
public UserProfile getUserProfile(String usernm) {
return (UserProfile)super.queryForObject("getUserProfile", usernm);
}
public List getUserProfileList(String usernm) {
return super.queryForList("getUserProfileList", usernm);
}
...
UserProfile.xml:
...
<select id="getUserProfile" parameterClass="string"
resultMap="userProfileResult">
select usernm, passwd, eng_name, chi_name, dob, join_date,
creation_date, created_by, last_update_date, last_update_by
from user_profile
where usernm = #usernm#
</select>
<select id="getUserProfileList" parameterClass="string"
resultMap="userProfileResult">
select usernm, passwd, eng_name, chi_name, dob, join_date,
creation_date, created_by, last_update_date, last_update_by
from user_profile
where usernm = #usernm#
</select>
...
Re: How to define xml of queryForObject and queryForList?
Posted by Larry Meadors <lm...@apache.org>.
Please read the docs, then post questions.
Larry
On 11/29/05, pc leung <pi...@gmail.com> wrote:
> How to define xml of queryForObject and queryForList?
>
> UserProfileSqlMapDao.java:
> ...
> public UserProfile getUserProfile(String usernm) {
> return (UserProfile)super.queryForObject("getUserProfile", usernm);
> }
>
> public List getUserProfileList(String usernm) {
> return super.queryForList("getUserProfileList", usernm);
> }
> ...
>
> UserProfile.xml:
> ...
> <select id="getUserProfile" parameterClass="string"
> resultMap="userProfileResult">
> select usernm, passwd, eng_name, chi_name, dob, join_date,
> creation_date, created_by, last_update_date, last_update_by
> from user_profile
> where usernm = #usernm#
> </select>
>
> <select id="getUserProfileList" parameterClass="string"
> resultMap="userProfileResult">
> select usernm, passwd, eng_name, chi_name, dob, join_date,
> creation_date, created_by, last_update_date, last_update_by
> from user_profile
> where usernm = #usernm#
> </select>
> ...
>