title: SQLite One-to-Many Relationship Set/Get Foreign Key
body: <p>I am building an android app project with SQLite DB.</p>
  
  <p>I got stuck on One-To-Many RelationShip.</p>
  
  <p>This is One</p>
  
  <pre><code>private static final String createTableOrders =
          "CREATE TABLE " + TABLE_ORDER + "("
                  + KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT,"
                  ...
                  + KEY_COLUMN_FORMATS + " INTEGER REFERENCES " + TABLE_FORMATS + "(" + KEY_ID + ")"
                  + ");";
  </code></pre>
  
  <p>This is Many</p>
  
  <pre><code>private static final String createTableFormats =
          "CREATE TABLE " + TABLE_FORMATS + "("
                  + KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT,"
                    ...
                  + ");";
  </code></pre>
  
  <p>My problems is with set/get methods. 
  Lets say that I would need to get list of ids of all Formats that are in one Order.
  I guess same thing goes for set method.</p>
  
  <p>I tried to find this kind of question on SO but most of the question were just for SQL part.</p>
  
  <p>P.S. Spent 3 hours trying to make it by myself but the only thing I got to was using GSON to code list of ids into String but it was just a dead-end.</p>
  
  <p>EDIT: I need to get that information inside the code.</p>
  
  <p>P.S.S I have been doing this for 18 hours so sorry if this is uber-stupid question.</p>