'how to insert query for annotation insert with parameter list in mybatis?

I able to insert data if without list parameter but i need it. Can any know how to do it using mybatis annotation @Insert with list Parameter?

//purchase_item_cart error since its list


    @Insert("INSERT INTO tb_client(client_guest_id, client_guest_name, client_guest_email,purchase_item_cart) " +
              " VALUES (#{client_guest_id}, #{client_guest_name}, #{client_guest_email},#{purchase_item_cart} )")

  @Options(useGeneratedKeys = true, keyColumn = "client_guest_id", keyProperty = "client_guest_id")
    public int insert(Client clientGuestRequest);

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Client {
    
    private Integer client_guest_id;

    private String client_guest_name;
    private String client_guest_email;
    private List<Integer> purchase_item_cart;
   
    
    }

//error

Caused by: java.lang.IllegalStateException: Type handler was null on parameter mapping for property 'purchase_item_cart'. It was either not specified and/or could not be found for the javaType (java.util.List) : jdbcType (null) combination.




Solution 1:[1]

I think you miss two points. One is missing range and the other is i must be in 0 ~ len(data) - 1.

(1, len(data) + 1) is just a tuple.

for i in range(len(data)):
    time = data[i][6].split(':')
    data[i][6] = Time(time[0], time[1], time[2])

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bossm0n5t3r