title: I can not get values from table. Relationship one to many
body: <p>Hi i have a problem with get many records from db
  this is my main table </p>
  
  <pre><code>@DatabaseTable(tableName = "MyTrips")
  public class MyTripTable {
  
  @DatabaseField(generatedId = true)
  private long id;
  
  @DatabaseField
  private long timestamp;
  
  
  @DatabaseField(foreign = true, foreignAutoRefresh = true )
  private ForeignCollection&lt;PortTable&gt; mPorts;
  
  public MyTripTable() {}
  
  public ForeignCollection&lt;PortTable&gt; getPorts() {
      return mPorts;
  }
  
  public long getId() {
      return id;
  }
  }
  </code></pre>
  
  <p>and here is second table</p>
  
  <pre><code>@DatabaseTable(tableName = "Ports")
  public class PortTable {
  
  @DatabaseField(generatedId = true)
  private long id;
  
  @DatabaseField
  private long timestamp;
  
  @DatabaseField(foreign = true, foreignAutoRefresh = true )
  private MyTripTable myTripTable;
  
  public PortTable() {}
  public void setTripAssigned(MyTripTable myTripTable){
      this.myTripTable = myTripTable;
  }
  }
  </code></pre>
  
  <p>And i need one <code>MyTrips</code> have more <code>Ports</code>
  I am doing this by this <a href="https://github.com/j256/ormlite-jdbc/tree/master/src/test/java/com/j256/ormlite/examples/foreignCollection" rel="nofollow">example</a> but doesn't work</p>
  
  <p>problem is here:</p>
  
  <pre><code>   private void strawberry(){
      DatabaseHelper helper = OpenHelperManager.getHelper(getApplicationContext(), DatabaseHelper.class);
      RuntimeExceptionDao&lt;MyTripTable, Long&gt; mTrip = helper.getTripRuntimeExcaptionDao();
      RuntimeExceptionDao&lt;PortTable, Long&gt; mPort = helper.getPortRuntimeExcaptionDao();
  
      long time1 = Calendar.getInstance().getTimeInMillis();
  
      //crate data
      MyTripTable myFirstTrip = new MyTripTable(153315, "Praha - Gothenburg",       "Big fat woman",
              time1,time1,time1,time1,1,5,6 );
     mTrip.create(myFirstTrip);
  
      PortTable port1 = new PortTable("Praha",
              "Praha is the capital and largest city of the Czech Republic. ",
              50.078047,
              14.427172);
      port1.setTripAssigned(myFirstTrip);
      PortTable port2 = new PortTable("Praha",
              "Praha is the capital and largest city of the Czech Republic. ",
              50.078047,
              14.427172);
      port2.setTripAssigned(myFirstTrip);
      PortTable port3 = new PortTable("Praha",
              "Praha is the capital and largest city of the Czech Republic. ",
              50.078047,
              14.427172);
      port3.setTripAssigned(myFirstTrip);
      PortTable port4 = new PortTable("Praha",
              "Praha is the capital and largest city of the Czech Republic. ",
              50.078047,
              14.427172);
      port4.setTripAssigned(myFirstTrip);
  
      mPort.create(port1);
      mPort.create(port2);
      mPort.create(port3);
      mPort.create(port4);
  
  
      //Get data
      Log.e("LSA", "----------------------------------TRIPS");
      List&lt;MyTripTable&gt; alltrips = mTrip.queryForAll();
      Log.e("LSA", "TRIPS" + alltrips.toString());
      for (MyTripTable trip : alltrips){
          Log.e("LSA", "Trip: " + trip.toString());
      }
  
      Log.e("LSA", "----------------------------------PORTS");
      List&lt;PortTable&gt; allPorts = mPort.queryForAll();
      Log.e("LSA", "PORTS" + allPorts.toString());
      for (PortTable port : allPorts){
          Log.e("LSA", "port: " + port.toString());
      }
  
      Log.e("LSA", "----------------------------------PORTs assigned");
  
      MyTripTable mOneTrip = mTrip.queryForId(myFirstTrip.getId());
      ForeignCollection&lt;PortTable&gt; mPortsForOneTrip = mOneTrip.getPorts();
  
      Log.e("LSA", "ports inside trip: " + mPortsForOneTrip);
      }
  </code></pre>
  
  <p>this part always return null </p>
  
  <pre><code>    ForeignCollection&lt;PortTable&gt; mPortsForOneTrip = mOneTrip.getPorts();
  </code></pre>
  
  <p>Can you help me? Where is a mistake? 
  Thank you for the response!</p>