title: to store a list of objects using hibernate in spring data
body: <p>I need to store a list of objects in db using hibernate in spring data. Basically my need is to store the list in a single interaction with database.</p>
  
  <p>for this, I am trying as below:</p>
  
  <pre><code>//a part of my code:
  if(vacationAirTravellerLegInfoList.size() != 0) {   
              customVacationAirTravellerLegInfoRepository.save(vacationAirTravellerLegInfoList);
  }
  </code></pre>
  
  <p>for this above part, 'customVacationAirTravellerLegInfoRepository' is object of custom repository I tried to implement as :</p>
  
  <pre><code>@Repository
  public interface CustomVacationAirTravellerLegInfoRepository extends VacationAirTravellerLegInfoRepository, CrudRepository&lt;VacationAirTravellerLegInfo, Integer&gt; {
      List&lt;VacationAirTravellerLegInfo&gt; save(List&lt;VacationAirTravellerLegInfo&gt; airTravellerLegInfoList);
  
  }
  </code></pre>
  
  <p>Implementation of this 'save(List)' method as :</p>
  
  <pre><code>public class CustomVacationAirTravellerLegInfoRepositoryImpl implements CustomVacationAirTravellerLegInfoRepository {
  
      private static SessionFactory sessionFactory;
  
      @Override
      public List&lt;VacationAirTravellerLegInfo&gt; save(List&lt;VacationAirTravellerLegInfo&gt; airTravellerLegInfoList) {
  
          try {
              //FIXME: exception on getting configuration object
              //sessionFactory = new Configuration().configure("hibernate.cfg.xml").buildSessionFactory(); 
              sessionFactory = new Configuration().configure().buildSessionFactory();
          } catch (Throwable ex) {
              System.err.println("Failed to create sessionFactory object." + ex);
              throw new ExceptionInInitializerError(ex);
          }
          Session session = sessionFactory.openSession();
          Transaction tx = null;
          try {
              tx = session.beginTransaction();
              for (int i = 0; i &lt; airTravellerLegInfoList.size(); i++) {
                  VacationAirTravellerLegInfo vacationAirTravellerLegInfo = airTravellerLegInfoList.get(i);
                  session.save(vacationAirTravellerLegInfo);
              }
              tx.commit();
          } catch (HibernateException e) {
              if (tx != null)
                  tx.rollback();
              e.printStackTrace();
          } finally {
              session.close();
          }
          return airTravellerLegInfoList;
      }
  
      //other inherited methods from the inherited are not mentioned here..
  
  }
  </code></pre>
  
  <p>when I am trying to execute <code>customVacationAirTravellerLegInfoRepository.save(vacationAirTravellerLegInfoList);</code> it is giving an exception as below :</p>
  
  <pre><code>{
      "timestamp": 1529303873662,
      "status": 500,
      "error": "Internal Server Error",
      "exception": "org.springframework.beans.NotReadablePropertyException",
      "message": "Invalid property 'id' of bean class [java.util.ArrayList]: Could not find field for property during fallback access!",
      "path": "/api/server/vacation/save"
  }
  </code></pre>
  
  <p>Anyone please suggest or correct me.</p>