title: getting ORA04091- table is mutating error while working with JDBC ,spring framework and oracle
body: <p>I  want to insert multiple rows in one go with oracle database.
  I am using spring framework. While using executeBatch();
  I am getting the error as ORA-04091: table FEED_IMPL is mutating trigger /function may not see it.</p>
  <p>Here is FeedManager.java code :</p>
  <pre><code>   //source for DataToInsert comes from a rowMapper class
      //for simplicity I am showing few of the data which is there in List&lt;feedData&gt;
      List&lt;feedData&gt; DataToInsert = [feedData(id =12,source_name =SYD,file_name=syd_210911.json),feedData(id =12,source_name =SYD,file_name=syd_210912.json),feedData(id =12,source_name =SYD,file_name=syd_210913.json)]
   int count =0;
  //myJDBCtemplate bean created in dbConfig
      DataSource ds= myJDBCtemplate.getJdbcTemplate().getDataSource();
      Connection conn = ds.getConnection();
      conn.setAutoCommit(false);
      final int batchSize = 200;
      PreparedStatement ps = conn.prepareStatement(query);
      for(feedData insertData: DataToInsert ) {
      ps.setInt(1,insertData.getId());//Id from DataToInsert 
      ps.setString(2,insertData.getSource());//source_name from DataToInsert 
      ps.setString(3,insertData.getFileName());//file_name from DataToInsert 
      ps.addBatch();
  if(++count % batchSize == 0) {
  ps.executeBatch();
  }    
  } 
      int[]affectedRows = ps.executeBatch();
      conn.commit();
  </code></pre>
  <p><strong>Query used:</strong>
  INSERT INTO FEED_IMPL(ID,SOURCE_NAME,FILE_NAME)VALUES(?,?,?)</p>
  <p>I want to have 200+ rows of inserts into database at a time, for question's simplicity I have shown data of 3 rows only inside <code>DataToInsert</code> List.</p>
  <p>Error I am getting here</p>
  <blockquote>
  <p>table FEED_IMPL is mutating, trigger/function may not see it ORA-06512
  : at &quot;FEED_IMPL_NEW_VERSION_TRG&quot;, line 5 ORA-04088: error during
  execution of trigger 'FEED_IMPL_NEW_VERSION_TRG'</p>
  </blockquote>