Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8892925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:07:41+00:00 2026-06-14T23:07:41+00:00

I am using MyBatis & Spring Framework. I have a DB Table STORE and

  • 0

I am using MyBatis & Spring Framework.
I have a DB Table STORE and it has some fields. I need to fetch records from the table using 2 fields in the table, say Name & Id.

select * from STORE where Name="Mels" & Id=123

I am using MAPPER Interface for the table. The MAPPER XML contains the Query.

For a single parameter query, I can use the following..

<select id="findAllSTOREByName"  parameterType="java.lang.String" resultMap="com.StoreObject">
select * from "STORE" where "NAME" = #{name}
</select>

Now, how do I pass multiple parameters like the case I mentioned earlier, with 2 different DataTypes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:07:43+00:00Added an answer on June 14, 2026 at 11:07 pm

    you have to use an object of a class, which can store your data (name & id),
    this could be a hashmap or any other data class.

    before calling your select statement, put the parameters into a hashmap or any other data class and in the select use the name of your value (it is stored in the key field of the hashmap or the name of the attribute of the used class)

    small snippet:

        HashMap<String, Object> values = new HashMap<String, Object>();
        values.put("id", 123);
        values.put("name", "Mels");
    

    …call findAllStoreByName with the hashmap as parameter

    change your select to the following:

        <select id="findAllSTOREByName"  parameterClass="hashmap"     resultMap="com.StoreObject">
            select * from "STORE" where NAME = #name# and id = #id#
        </select>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get the list of columns in a table using mybatis/ibatis in
I am using MyBatis 3.0.3 and have problem: some columns in database have names
I have web application which using spring wicket and sql-processor (similar to mybatis) which
I'm currently working with MyBatis-Spring integration framework and that's what I read from docs:
I am using mybatis to retrieve data from DB, the data returned is containing
Let's say I have swing app and I am using mybatis: public class MyAppCView
I want to build an application using Hibernate and MyBatis integrate with Spring. In
I am using MyBatis with MySql in my project. I have: myField ENUM('yes','no') and
I have a web application set up with MyBatis and Spring, but it doesn't
(Using MyBatis v3.0.4.) I have a problem that I do not know how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.