How can I pass multiple parameters and use them?

Jin Kwon

Hi I'm new to myBatis.

I'm using MyBatis and Spring with mybatis-spring.

How can I pass two different types of objects as parameters, and how can I use their properties in query?

<update id="update" parameterType="A, B"> <!-- @@? -->
  UPDATE SOME WHERE x=A.x AND y=B.y <!-- @@? -->
</update>
Roman Konoval

Do not specify parameterType but use @Param annotation on parameters in mapper:

@Mapper
public interface MyMapper {

    void update(@Param("a") A a, @Param("b") B b);

    ...
}

Then reference them in mapping:

<update id="update" > 
   UPDATE SOME WHERE x=#{a.x} AND y=#{b.y}
</update>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I use multiple parameters in find?

From Dev

How can I pass multiple parameters through a React <select> component?

From Dev

How I can pass multiple parameters to URL in php

From Dev

How can i pass multiple parameters in location.href in php?

From Dev

With curl, how can I pass multiple command line parameters in a POST?

From Dev

How to pass arguments into a bat file and use them as parameters for an executable

From Dev

How can I pass global Meteor variables to templates and access and use them?

From Dev

How can i pass parameters to a background worker?

From Dev

How can I pass a parameters to a Java Thread?

From Dev

How can i pass parameters to a background worker?

From Dev

How can I pass parameters to a modal in Ionic?

From Dev

Can I use CRTP with multiple derived classes, and use them polymorphically?

From Dev

How can I pass multiple named parameters using ODBC to a DB2 database

From Dev

How can I use multiple 'Data' instance when one of them is 'deduced' from a type function?

From Dev

How can I use multiple b-form-radio-group avoiding visual interference among them?

From Dev

Swift - How can I pass a function with parameters in parameters of a function?

From Dev

Swift - How can I pass a function with parameters in parameters of a function?

From Dev

How can I lookup based on multiple parameters?

From Dev

Can I pass parameters to a Singleton class in Swift? And general Singleton use

From Dev

How can I pass the file names to xargs and truncate them?

From Dev

Django template blocks: how can i reuse them and how do i pass HTML into them?

From Dev

How can I use parameters in gradle tasks?

From Dev

How can I use type traits to compare only the first template parameter in class that has multiple parameters?

From Java

How do I pass multiple parameters into a function in PowerShell?

From Dev

How should I pass multiple DateTime parameters to an ApiController method?

From Dev

How to pass multiple parameters in a value attribute and put them in an associative array in the name attribute?

From Dev

Can I call variables to the parameters of the method when I use them inside my method?

From Dev

Why can't I use multiple type parameters with a wildcard?

From Dev

How can I take multiple line matches and assign them to a hash?

Related Related

  1. 1

    How can I use multiple parameters in find?

  2. 2

    How can I pass multiple parameters through a React <select> component?

  3. 3

    How I can pass multiple parameters to URL in php

  4. 4

    How can i pass multiple parameters in location.href in php?

  5. 5

    With curl, how can I pass multiple command line parameters in a POST?

  6. 6

    How to pass arguments into a bat file and use them as parameters for an executable

  7. 7

    How can I pass global Meteor variables to templates and access and use them?

  8. 8

    How can i pass parameters to a background worker?

  9. 9

    How can I pass a parameters to a Java Thread?

  10. 10

    How can i pass parameters to a background worker?

  11. 11

    How can I pass parameters to a modal in Ionic?

  12. 12

    Can I use CRTP with multiple derived classes, and use them polymorphically?

  13. 13

    How can I pass multiple named parameters using ODBC to a DB2 database

  14. 14

    How can I use multiple 'Data' instance when one of them is 'deduced' from a type function?

  15. 15

    How can I use multiple b-form-radio-group avoiding visual interference among them?

  16. 16

    Swift - How can I pass a function with parameters in parameters of a function?

  17. 17

    Swift - How can I pass a function with parameters in parameters of a function?

  18. 18

    How can I lookup based on multiple parameters?

  19. 19

    Can I pass parameters to a Singleton class in Swift? And general Singleton use

  20. 20

    How can I pass the file names to xargs and truncate them?

  21. 21

    Django template blocks: how can i reuse them and how do i pass HTML into them?

  22. 22

    How can I use parameters in gradle tasks?

  23. 23

    How can I use type traits to compare only the first template parameter in class that has multiple parameters?

  24. 24

    How do I pass multiple parameters into a function in PowerShell?

  25. 25

    How should I pass multiple DateTime parameters to an ApiController method?

  26. 26

    How to pass multiple parameters in a value attribute and put them in an associative array in the name attribute?

  27. 27

    Can I call variables to the parameters of the method when I use them inside my method?

  28. 28

    Why can't I use multiple type parameters with a wildcard?

  29. 29

    How can I take multiple line matches and assign them to a hash?

HotTag

Archive