I tried to insert the list into the database, but I have an error: org.springframework.jdbc.BadSqlGrammarException: SqlSession operation; bad SQL grammar []; The nested exception is java.sql.SQLException: ORA-00913: too many values ββ(...).
The code I used:
<insert id="insertListMyObject" parameterType="java.util.List" > INSERT INTO my_table (ID_ITEM, ATT1, ATT2) VALUES <foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
My dao cals method:
SqlSessionTemplate().insert(MAPPER+".insertListMyObject", parameterList);
Where is the parameter List:
List<MyObjects>.
Does anyone know what this error is? Or, if there is a better way to do operations with multiple inserts.
Thank you very much!
source share