list
Java exception#BindingException:Parameter‘xxList‘notfound.Availableparametersare[collection,list]
1. Problem When implementing SQL batch insertion and returning the primary key id of each piece of data through the mybatis framework, an exception occurs: Caused by: org.apache.ibatis.binding.BindingException : Parameter ‘couponCodeList’ not found. Available parameters are [collection, list] 1 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding. BindingException: Parameter ‘couponCodeList’ not found. Available parameters are [collection, list] 2 at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java: 73) 3 at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:364) 4 at com.sun.proxy.$Proxy34.insert(Unknown Source) 5 at org.mybatis.spring.SqlSessionTemplate.insert (SqlSessionTemplate.java:236) 6 at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:52) 7 at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53) 8 at com.sun.proxy.$Proxy77.batchSaveCouponCodeList(Unknown Source) 9 at com.yyw.hs.eshop.promotion.manage.EshopCouponManageService.batchSaveCouponCode(EshopCouponManageService .java:200)10 at com.yyw.hs.eshop.promotion.manage.EshopCouponManageService.createCouponActivity(EshopCouponManageService.java:144)11 at com.yyw.hs.eshop.promotion.EshopCouponServiceTest.testCreateCouponActivity4(EshopCouponServiceTest.java:125)12 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)13 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62 )14 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)15 at java.lang.reflect.Method.invoke(Method.java:498)16 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod. java:50)17 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)18 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)19 at org .junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)20 at org.springframework.test.context.junit4.statements. RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:73)21 at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82 )22 at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:73)23 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)24 at org.springframework. test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:217)25 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner .java:83)26 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)27 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)28 at org.junit. runners.ParentRunner.runChildren(ParentRunner.java:288)29 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58 )30 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)31 at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)32 at org.springframework.test. context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68)33 at org.junit.runners.ParentRunner.run(ParentRunner.java:363 )34 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163) 35 at org.junit.runner.JUnitCore.run(JUnitCore.java:137)36 at com.intellij.junit4. JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)37 at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)38 at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) 39 at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)40 Caused by: org.apache.ibatis.binding.BindingException: Parameter ‘couponCodeList’ not found. Available parameters are [collection, list]41 at org.apache.ibatis.session.defaults.DefaultSqlSession$StrictMap.get(DefaultSqlSession.java:294)42 at org.apache.ibatis.scripting. xmltags.DynamicContext$ContextAccessor.getProperty(DynamicContext.java:115)43 at org.apache.ibatis.ognl.OgnlRuntime.getProperty(OgnlRuntime.java:2420 )44 at org.apache.ibatis.ognl.ASTProperty.getValueBody(ASTProperty.java:114)45 at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)46 at org.apache.ibatis. ognl.SimpleNode.getValue(SimpleNode.java:258)47 at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:494)48 at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:458)49 at org.apache.ibatis.scripting.xmltags.OgnlCache.getValue(OgnlCache.java:44)50 at org.apache.ibatis. scripting.xmltags.ExpressionEvaluator.evaluateIterable(ExpressionEvaluator.java:43)51 at org.apache.ibatis.scripting.xmltags.ForEachSqlNode.apply(ForEachSqlNode.java :55)52 at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:33)53 at…
The basic collection of Java is very important and very detailed, collection, list, set, map. The path to growth as a programmer.
Collection: 1. Understanding and benefits of collection: 1. Array: (1) The length must be specified at the beginning, and once created, it cannot be changed; ( 2) The elements saved must be of the same type; (3) The schematic code for enhancing/deleting elements using data rent – comparison and placement //Write the schematic code for Person array expansion: Person[] pers = new Person[1];//The size is 1per(0) = new
Java converts xml, list, map and json
Many friends have encountered the problem of converting between xml, map and json. xml and json are becoming more and more important in development. I’ll post my tool class. package com.shine.framework.core.util;import java.io.ByteArrayOutputStream;import java.util.ArrayList;import java.util. HashMap;import java.util.Iterator;import java.util.List;import java.util.Map;import net.sf.json.JSON; import net.sf.json.JSONSerializer;import net.sf.json.xml.XMLSerializer;import org.dom4j.Document;import org.dom4j.DocumentHelper;import org.dom4j.Element;import org.dom4j.io.OutputFormat;import org.dom4j.io.XMLWriter;/** * common xml conver utility * * @author viruscodecn@gmail.com * @version Framework 2010.10.26 * @url http://blog.csdn.net/arjick/article/details/6251777 */ public class XmlConverUtil { /** * map to xml xml value1<key * label=”key2″>value2 …… * * @param map * @return */ public static String maptoXml(Map map) { Document document = DocumentHelper.createDocument(); Element nodeElement = document.addElement(“node”); for (Object obj : map.keySet()) { Element keyElement = nodeElement.addElement( “key”); keyElement.addAttribute(“label”, String.valueOf(obj)); keyElement.setText(String.valueOf(map.get(obj))); } return doc2String(document); } /** * list to xml xml value1<key * label=”key2″>value2……<key * label=”key1″>value1<key * label=”key2″>value2…… * * @param list * @return */ public static String listtoXml(List list) throws Exception { Document document = DocumentHelper.createDocument(); Element nodesElement = document.addElement(“nodes”); int i = 0; for (Object o : list) { Element nodeElement = nodesElement.addElement(“node”); if (o instanceof Map) { for (Object obj : ((Map) o).keySet() ) { Element keyElement = nodeElement.addElement(“key”); keyElement.addAttribute(“label”, String.valueOf(obj)); keyElement.setText(String.valueOf(((Map ) o).get(obj))); } } else { Element keyElement = nodeElement.addElement(“key”); keyElement.addAttribute(“label”, String.valueOf (i));…

[Java Basics Consolidation Series] Java data collections, List, Map, Set, JUC, everything you need
Popular Series: [Java Basics Consolidation Series] Java Memory Overflow and Memory Leak [Java Basics Consolidation Series] Java class initialization execution sequence [Java Basics Consolidation Series] The most comprehensive technical architecture mind map for advanced Java advancement [Java Basics Consolidation Series] Understanding Java Parental Delegation Mechanism Programming Life,Wonderful Preview Table of contents 1. Preface 2. Collection framework 3 .Set interface 3.1 The difference between Set and List 4. Commonly used collection implementation classes 4.1 ArrayList 4.2 LinkedList 4.3 HashMap 4.4 HashTable 4.5 ConcurrentHashMap 4.6 TreeMap 4.7 HashSet 5 .Five commonly used concurrency packages 5.1 ConcurrentHashMap 5.2 CopyOnWriteArrayList 5.3 CopyOnWriteArraySet 5.4 ArrayBlockingQueue 5.5 LinkedBlockingQueue 6. Summary 1. Preface Data storage includes a variety of data structures. But overall it can be divided into four categories: linear tables, hash trees, and graphs. And our java actually also has its own commonly used “data structure” – that is, collections. But the underlying implementation of collections in Java is also implemented by data structures such as arrays, linked lists, and trees. Below we will give a certain in-depth explanation of some commonly used collections. 2. Collection framework As a Java developer, you must know all the commonly used collections. Let’s use a picture to list…
Java converts xml, list, map and json
Many friends have encountered the problem of converting between xml, map and json. xml and json are becoming more and more important in development. I’ll post my tool class. package com.shine.framework.core.util;import java.io.ByteArrayOutputStream;import java.util.ArrayList;import java.util. HashMap;import java.util.Iterator;import java.util.List;import java.util.Map;import net.sf.json.JSON; import net.sf.json.JSONSerializer;import net.sf.json.xml.XMLSerializer;import org.dom4j.Document;import org.dom4j.DocumentHelper;import org.dom4j.Element;import org.dom4j.io.OutputFormat;import org.dom4j.io.XMLWriter;/** * common xml conver utility * * @author viruscodecn@gmail.com * @version Framework 2010.10.26 * @url http://blog.csdn.net/arjick/article/details/6251777 */ public class XmlConverUtil { /** * map to xml xml value1<key * label=”key2″>value2 …… * * @param map * @return */ public static String maptoXml(Map map) { Document document = DocumentHelper.createDocument(); Element nodeElement = document.addElement(“node”); for (Object obj : map.keySet()) { Element keyElement = nodeElement.addElement( “key”); keyElement.addAttribute(“label”, String.valueOf(obj)); keyElement.setText(String.valueOf(map.get(obj))); } return doc2String(document); } /** * list to xml xml value1<key * label=”key2″>value2……<key * label=”key1″>value1<key * label=”key2″>value2…… * * @param list * @return */ public static String listtoXml(List list) throws Exception { Document document = DocumentHelper.createDocument(); Element nodesElement = document.addElement(“nodes”); int i = 0; for (Object o : list) { Element nodeElement = nodesElement.addElement(“node”); if (o instanceof Map) { for (Object obj : ((Map) o).keySet() ) { Element keyElement = nodeElement.addElement(“key”); keyElement.addAttribute(“label”, String.valueOf(obj)); keyElement.setText(String.valueOf(((Map ) o).get(obj))); } } else { Element keyElement = nodeElement.addElement(“key”); keyElement.addAttribute(“label”, String.valueOf (i));…
Detailed explanation of PHP array processing using three functions such as foreach, list, and each
This article introduces how to use the three functions foreach, list, and each for traversing arrays in PHP: Method 1: foreach<?php$sports = array(football => good,swimming => very well ,running => not good);foreach ($sports as $key => $value) {echo $key.”: “.$value.”“;?> Output result:football: goodswimming: very wellrunning: not good Method 2: each<?php$sports = array(football => good,swimming => very well ,running => not good);while ($elem = each($sports)) {echo $elem[key].”: “.$elem[value].”“; ?> Method 3: list & each<?php$sports = array(football => good,swimming => very well,running => not good);while (list($key, $value) = each($sports)) {echo $key.”: “.$value.”“;?>
Summary of PHP array traversal statements (foreach, for, list, each)
There are several methods for traversing and reading arrays in PHP. foreach, for, list, each, and while are all possible, but the one is more suitable for traversing arrays. When using foreach to access, is the order of traversal fixed? In what order should it be traversed? For example: the code is as follows: <?php $colors= array('red','blue' ,'green','yellow'); foreach ($colors as $color){ //add your codes } ?> Example 2, the code is as follows: $capitals= array( “Ohio”=> “Columbus”,“Towa”=> “Des Moines”,“Arizona”=> “Phoenix”); foreach($capitals as $key=> $ val){ //add your codes } while() while() is usually used in conjunction with list() and each(). The example code is as follows: <?php $colors = array('red','blue' ,'green','yellow'); while(list($key,$val) = each($colors)) { echo “Other list of $val.“ ; } ?> /* Display results: Other list of red. Other list of blue. Other list of green. Other list of yellow. */ 3. for(),The example code is as follows: <?php $arr = array (“0” => “zero”,“1” => “one”,“2” => “two”); for ($i = 0;$i < count($arr); $i++) { $str = $arr$people)) { echo “$key => $val“ ; } ?> /* Output: 0 => Peter 1 => Joe 2 => Glenn 3 => Cleveland */ Recursive traversal of multi-dimensional…
PHP Development (21)-Use foreach, list, while, each to traverse arrays-PhpStorm
foreach: There are many methods for traversing arrays. In other languages, arrays with consecutive subscripts are generally traversed using for, but based on The particularity of PHP arrays, we generally use foreach, and sometimes each. First, let’s take a look at arrays in most languages: $arr = array(“a”, “b”, ” c”, “d”, “e”, “f”, “g”); Then let’s take a look, PHP Array forms that can exist in: $arr2 = array(“a”, “b”, 100=>”c”, “d”, “xxx”=>”e”, “f”, “g”); Yes, arr2 cannot be traversed using for~~So, there is a powerful foreach method~~ foreach has 2 expressions: 1. foreach (array as custom variable) 2. foreach (array as subscript variable => value variable) list: list() Assigns a value to a set of variables in one operation. Note that list can only convert consecutively indexed arrays into variables. I personally feel that list does not have any advantages, except when used with the explode function. explode() explodes a string into an array. In the following code, an example is demonstrated: list($name, $web) = explode(“_”,$ str); each: each() returns The key name and key value of the current element and moves the internal pointer forward. current() – Returns the value of the current element in the array.…
Complete list of PHP array traversal methods (foreach, list, each)_PHP tutorial
Arrays are divided into two categories in PHP: numerically indexed arrays and associative arrays. The numeric index array is the same as the array in C language, the subscripts are 0, 1, 2… The subscript of the associative array may be of any type, similar to hash, map and other structures in other languages. The following introduces three methods of traversing associative arrays in PHP: Method 1: foreach The code is as follows: <?php $sports = array( ‘football’ => ‘good’, ‘swimming’ => ‘very well’, ‘running’ => ‘not good ‘); foreach ($sports as $key => $value) { echo $key.”: “.$value.”“; ?> Output result: football: good swimming: very well running: not good Method 2: each The code is as follows: <?php $sports = array( ‘football’ => ‘good’, ‘swimming’ => ‘very well ‘, ‘running’ => ‘not good’); while ($elem = each($sports)) { echo $elem[‘key’].”: “.$elem[ ‘value’].”“; ?> Method 3: list & each The code is as follows: <?php $sports = array( ‘football’ => ‘good’, ‘swimming’ => ‘very well’, ‘running’ => ‘not good’); while (list($key, $value) = each($sports)) { echo $key.”: “.$value.”“; ?> http://www.bkjia.com/PHPjc/322119.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/322119.htmlTechArticleArrays in PHP are divided into two categories: numerical index arrays and associative arrays. The numeric index array is the same…
Summary of PHP array traversal statements (foreach, for, list, each)_PHP tutorial
When using foreach to access, is the order of traversal fixed? In what order should it be traversed? For example: The code is as follows <?php $colors= array(‘red’,’blue’,’green’,’yellow’); foreach ($colors as $color){ //add your codes } ?> Example 2 $capitals= array(“Ohio”=> “Columbus”,”Towa”=> “Des Moines”,”Arizona”=> “Phoenix”); foreach($capitals as $key=> $val){ //add your codes } while() while() is usually used in conjunction with list() and each(). #example2: The code is as follows <?php $colors = array(‘red’,’blue’,’green’,’yellow’); while(list($key,$val) = each($colors)) { echo “Other list of $val.“; } ?> Display results: Other list of red. Other list of blue. Other list of green. Other list of yellow. 3. for() #example3: The code is as follows <?php $arr = array (“0” => “zero”,”1″ => “one”,”2″ => “two”); for ($i = 0;$i <count($arr); $i++) { $str = $arr[$i]; echo “the number is $str.“; } ?> Display results: the number is zero. the number is one. the number is two. ========== The following is an introduction to the function ========== key() mixed key(array input_array) The key() function returns the key element in input_array at the current pointer position. #example4 The code is as follows <?php $capitals = array(“Ohio” => “Columbus”,”Towa” => “Des Moines”,”Arizona” => “Phoenix”); echo “…