Search in sources :

Example 26 with Model

use of com.orm.androrm.Model in project androrm by androrm.

the class ModelTest method testSaveAutoincrementOverwrite.

public void testSaveAutoincrementOverwrite() {
    Model m = new BlankModelNoAutoincrement();
    // initial id has to be given
    assertFalse(m.save(getContext()));
    assertTrue(m.save(getContext(), 5));
    assertEquals(5, m.getId());
    // after id is set, regular save function works
    assertTrue(m.save(getContext()));
}
Also used : BlankModelNoAutoincrement(com.orm.androrm.impl.BlankModelNoAutoincrement) Model(com.orm.androrm.Model) BlankModel(com.orm.androrm.impl.BlankModel)

Aggregations

Model (com.orm.androrm.Model)26 DatabaseAdapter (com.orm.androrm.DatabaseAdapter)22 ArrayList (java.util.ArrayList)22 BlankModel (com.orm.androrm.impl.BlankModel)9 EmptyModel (com.orm.androrm.impl.migration.EmptyModel)5 BlankModelNoAutoincrement (com.orm.androrm.impl.BlankModelNoAutoincrement)3 Product (com.orm.androrm.impl.Product)3 Branch (com.orm.androrm.impl.Branch)2 Brand (com.orm.androrm.impl.Brand)2 TableDefinition (com.orm.androrm.TableDefinition)1 Supplier (com.orm.androrm.impl.Supplier)1 ModelWithMigration (com.orm.androrm.impl.migration.ModelWithMigration)1 NewEmptyModel (com.orm.androrm.impl.migration.NewEmptyModel)1 OneFieldModel (com.orm.androrm.impl.migration.OneFieldModel)1