title: How to save a list of objects in spring web mvc
body: <p>Can I save a list of objects in a transaction like we normally save single objects using <code>session#save(object)</code> I tried this code to save a list of objects, </p>
  
  <pre><code>public List&lt;TfmImage&gt; save(List&lt;TfmImage&gt; images) {
          Session session = getSession();
          Transaction transaction = createTransaction(session);
          try {
              session.save(images);
              commitTransaction(transaction);
              session.refresh(images);
          }catch (Exception e) {
              System.out.println(e.getMessage());
          } finally {
              closeSession(session);
          }
          return images;
      }
  </code></pre>
  
  <p>but it is throwing exception , <code>MappingException</code> and the detailed message is,
  <code>unknownEntity : java.util.ArrayList</code> <strong>from the detail message, it is clear that ArrayList is not an entity in my project</strong> How can I save the list of objects? Do I have to iterate through the list and save then one by one? Is there an efficient way to save a list of objects like we normally save single object.</p>