title: Robospice + Retrofit + ORMLite
body: <p>I'm using Robospice with Retrofit ans ORMLite modules. Retrofit part working good. I have City model for Retrofit:</p>
  
  <p><strong>City.java:</strong></p>
  
  <pre><code>public class City {
      public int city_id;
      public String name;
  
      @SuppressWarnings("serial")
      public static class List extends ArrayList&lt;City&gt; {
      }
  }
  </code></pre>
  
  <p>I'm taking this model from server by GET-request:</p>
  
  <p><strong>MyApi.java</strong></p>
  
  <pre><code>public interface MyAPI {
      @GET("/cities")
      City.List getCities();
  }
  </code></pre>
  
  <p>This part works fine by calling this method:</p>
  
  <pre><code>getSpiceManager().execute(mRequestCity, "city", DurationInMillis.ONE_MINUTE, new ListCityRequestListener());
  </code></pre>
  
  <p>and listener:</p>
  
  <pre><code>public final class ListCityRequestListener implements RequestListener&lt;City.List&gt; {
  
      @Override
      public void onRequestFailure(SpiceException spiceException) {
          Toast.makeText(RegisterActivity.this, "failure", Toast.LENGTH_SHORT).show();
      }
  
      @Override
      public void onRequestSuccess(final City.List result) {
          Toast.makeText(RegisterActivity.this, "success", Toast.LENGTH_SHORT).show();
          updateCities(result);
      }
  }
  </code></pre>
  
  <p>At this time i want to download city list once from server and store this list into sqlitedb by ORMLite module. I've created ORMLite model:</p>
  
  <p><strong>City.java</strong></p>
  
  <pre><code>@DatabaseTable(tableName = "city")
  public class City {
      public final static String DB_CITY_ID_FIELD_NAME = "id";
      public final static String DB_CITY_NAME_FIELD_NAME = "name";
  
      @DatabaseField(canBeNull =  false, dataType = DataType.INTEGER, columnName = DB_CITY_ID_FIELD_NAME)
      int id;
  
      @DatabaseField(canBeNull = false, dataType = DataType.STRING, columnName = DB_CITY_NAME_FIELD_NAME)
      private String name;
  
      public City() {
  
      }
  
      @Override
      public String toString() {
          StringBuilder sb = new StringBuilder();
  
          sb.append("id = ").append(id);
          sb.append(", ").append("name = ").append(name);
  
          return sb.toString();
      }
  }
  </code></pre>
  
  <p>My <strong>RetrofitSpiceService.java</strong> looks like this:</p>
  
  <pre><code>public class RetrofitSpiceService extends RetrofitGsonSpiceService {
  
      private final static String BASE_URL = "http://example.com/api/v1";
      private final static UserFunctions userFunctions = new UserFunctions();
  
      @Override
      public CacheManager createCacheManager(Application application) throws CacheCreationException {
          CacheManager cacheManager = new CacheManager();
          List&lt; Class&lt; ? &gt;&gt; classCollection = new ArrayList&lt; Class&lt; ? &gt;&gt;();
  
          // add persisted classes to class collection
          classCollection.add( City.class );
  
          // init
          RoboSpiceDatabaseHelper databaseHelper = new RoboSpiceDatabaseHelper( application, "sample_database.db", 1 );
          InDatabaseObjectPersisterFactory inDatabaseObjectPersisterFactory = new InDatabaseObjectPersisterFactory( application, databaseHelper, classCollection );
          cacheManager.addPersister( inDatabaseObjectPersisterFactory );
  
          return cacheManager;
      }
  
      @Override
      protected Builder createRestAdapterBuilder() {
          Builder mBuilder = super.createRestAdapterBuilder();
  
          mBuilder.setRequestInterceptor(new RequestInterceptor() {
              @Override
              public void intercept(RequestFacade request) {
                  if (userFunctions.isUserLoggedIn()) {
                      request.addHeader("Authorization", userFunctions.getToken());
                  }
              }
          });
  
          return mBuilder;
      }
  
      @Override
      public void onCreate() {
          super.onCreate();
          addRetrofitInterface(MyAPI.class);
      }
  
      @Override
      protected String getServerUrl() {
          return BASE_URL;
      }
  }
  </code></pre>
  
  <p>I can't understand how can i store and read data from my <strong>City</strong> database? How do i need to change RetrofitSpiceService? I want download data by <strong>Retrofit</strong> and store it to database by <strong>ORMLite</strong>. My CacheManager is correct, i.e. will work properly? Maybe I misunderstand how the module <strong>Robospice-ORMLite</strong> works? </p>
  
  <p>Thanks a lot!</p>