title: How to insert into database from List<Object> (nested) using JDBC
body: <p>I have 3 different tables in which I want to insert my data which comes in the form of JSON. Following is how my data is structured.</p>
  
  <p>Stream Class:</p>
  
  <pre><code>public class StreamsID {
      private Long id;
      private Long campaign_id;
      private Long credential_id;
      private String user_id;
      private String custom_name;
      private List&lt;Item&gt; items;
  }
  </code></pre>
  
  <p>Item class:</p>
  
  <pre><code>public class Item {
      private Long stream_id;
      private String stream_item_date;
      private String channel;
      private List&lt;Workflow&gt; workflow;
      private List&lt;Responses&gt; responses;
  </code></pre>
  
  <p>Workflow Class:</p>
  
  <pre><code>public class Workflow {
      public static final String FIND_ALL = "findAll";
      private Long id;
      private User actor;
      private User assignee;
      private String date;
      private String team;
      private String action;
  </code></pre>
  
  <p>I am using PreparedStatement to insert the data:</p>
  
  <pre><code>PreparedStatement statement = connection.prepareStatement("INSERT INTO public.streams(" +
                          "stream_id, stream_campaign_id," +
                          "stream_user_id, stream_custom_name) " +
                          "VALUES (?, ?, ?, ?);");
          statement.setLong(1,stream.getId());
          statement.setLong(2,stream.getCampaign_id());
          statement.setLong(3,stream.getCredential_id());
          statement.setString(4,stream.getUser_id());
          statement.setString(5,stream.getCustom_name());
  </code></pre>
  
  <p>The problem with this approach is that i am unable to save the Item and workflow tables. I am not sure how to implement this in JDBC. The database we are using is Postgresql. </p>
  
  <p>This was far easier when i used JPA but we had to switch to JDBC for some constraints. Any help with this is highly appreciated. </p>