title: Persisting a Collection class with ORMLite in android
body: <p>I have two classes setup like the following.  I am confused as to when I need to annotate something as an foreign collection and when I do not.  This may also sound silly, but nowhere in the <code>ORMLite</code> documentation does it say whether or not a non-foreign collection is allowed.  What if I have a List of <code>int</code>s which get autoboxed into <code>Integer</code>s?  can I just persist this using a standard <code>@DatabaseField</code> above the <code>Collection</code>?  A foreign collection, according to <code>ORMLite</code>, must also have  back reference for it to work (a reference to the parent, given a one to many realtionship).  For the example below, I am assuming you should annotate <code>myBList</code> as a foreign collection as well as making <code>myA</code> a foreign object, but how could you handle <code>myStringList</code>?</p>
  
  <p>I Have seen sample code here but it doesn't answer my questions: <a href="http://ormlite.com/docs/examples" rel="nofollow">http://ormlite.com/docs/examples</a></p>
  
  <pre><code>public class A {
  
      private Set&lt;B&gt; myBList = new HashSet&lt;B&gt;();
      private List&lt;String&gt; myStringList = new ArrayList&lt;String&gt;();
      private long id;    
      public A(){}
  
      public Set&lt;B&gt; getMyBList() {
          return myBList;
      }
      public void setMyBList(Set&lt;B&gt; myBList) {
          this.myBList = myBList;
      }
      public List&lt;String&gt; getMyStringList() {
          return myStringList;
      }
      public void setMyStringList(List&lt;String&gt; myStringList) {
          this.myStringList = myStringList;
      }
      public void setId(long id){
          this.id = id;
      }
  
      public long getId(){
          return id;
      }
  }
  
  public class B {
      private int myInt;
      private String myString;
      private A myA;
      private long id;
  
      public B(){}
  
      public A getMyA(){
           return myA;
      }
      public A setMyA(A a){
          myA = a;
      }
  
      public int getMyInt() {
          return myInt;
      }
      public void setMyInt(int myInt) {
          this.myInt = myInt;
      }
      public String getMyString() {
          return myString;
      }
      public void setMyString(String myString) {
          this.myString = myString;
      }
  
      public void setId(long id){
          this.id = id;
      }
  
      public long getId(){
          return id;
      }
  }
  </code></pre>