Buggy code:
public enum ItemsDataSource { HOST_INSTANCE ( ) { Context initialize ( ) { } } , GUEST_INSTANCE ( ) { Context initialize ( ) { } } ; ItemsDataSource ( ) { } abstract Context initialize ( ) throws IllegalStateException { } public static final String [ ] MENU_CATEGORIES_SEED = new String [ ] { "Appetizers" , "Entrees" , "Beverages" , "Soups<seq2seq4repair_space>and<seq2seq4repair_space>Salads" , "Sides" , "Desserts" } ; public static final String DB_NAME = "menu.db" ; public static final int DB_VERSION = 18 ; public static final String ITEMS_TABLE = "Items" ; public static final String COLUMN_ITEM_ID = "ID" ; public static final String COLUMN_ITEM_NAME = "Item_Name" ; public static final String COLUMN_ITEM_PRICE = "Item_Price" ; public static final String COLUMN_ITEM_CATEGORY_ID = "Category_ID" ; public static final String COLUMN_ITEM_IS_LIMITED = "Is_Limited" ; public static final String COLUMN_ITEM_QUANTITY = "Quantity" ; public static final String CATEGORIES_TABLE = "Categories" ; public static final String COLUMN_CATEGORY_ID = "ID" ; public static final String COLUMN_CATEGORY_NAME = "Category_Name" ; public static final String COLUMN_CATEGORY_SECTION = "Category_Section" ; public static final String ORDER_SUMMARY_TABLE = "Order_Summaries" ; public static final String COLUMN_ORDERSUMMARY_ID = "ID" ; public static final String COLUMN_ORDERSUMMARY_CUSTOMER_NAME = "Customer_Name" ; public static final String COLUMN_ORDERSUMMARY_TIMESTAMP = "Order_Timestamp" ; public static final String ORDER_DETAILS_TABLE = "Order_Details" ; public static final String COLUMN_ORDERDETAILS_ORDERID = "Order_ID" ; public static final String COLUMN_ORDERDETAILS_ITEMID = "Item_ID" ; public static final String COLUMN_ORDERDETAILS_ITEMQUANTITY = "Item_Quantity" ; public static final String COLUMN_ORDERDETAILS_ITEMPRICE = "Item_Price" ; ItemsDataSource . SQLHelper helper ; SQLiteDatabase database ; Context context ; private boolean isOpened = false ; private String [ ] readableColumnsItemsTable = new String [ ] { ItemsDataSource . COLUMN_ITEM_ID , ItemsDataSource . COLUMN_ITEM_NAME , ItemsDataSource . COLUMN_ITEM_PRICE , ItemsDataSource . COLUMN_ITEM_CATEGORY_ID , ItemsDataSource . COLUMN_ITEM_IS_LIMITED , ItemsDataSource . COLUMN_ITEM_QUANTITY } ; private String [ ] readableColumnsCategoriesTable = new String [ ] { ItemsDataSource . COLUMN_CATEGORY_ID , ItemsDataSource . COLUMN_CATEGORY_NAME , ItemsDataSource . COLUMN_CATEGORY_SECTION } ; private ArrayList < Category > categories ; public static String toCategoryName ( String string ) { } public ArrayList < Category > getCategories ( ) { } public ArrayList < Category > getCategories ( Section section ) { } public String toDisplayName ( String string ) { } public void open ( ) throws SQLiteException { } public void close ( ) { } public boolean isOpened ( ) { } public void addItem ( Item item ) { ContentValues newItem = new ContentValues ( ) ; newItem . put ( ItemsDataSource . COLUMN_ITEM_NAME , item . getName ( ) ) ; newItem . put ( ItemsDataSource . COLUMN_ITEM_PRICE , item . getPrice ( ) ) ; <START_BUG> newItem . put ( ItemsDataSource . COLUMN_ITEM_CATEGORY_ID , item . getCategory ( ) . getName ( ) ) ; <END_BUG> newItem . put ( ItemsDataSource . COLUMN_ITEM_IS_LIMITED , ( item . isQuantityLimited ( ) ? 1 : 0 ) ) ; newItem . put ( ItemsDataSource . COLUMN_ITEM_QUANTITY , item . getQuantityAvailable ( ) ) ; try { database . insertOrThrow ( ItemsDataSource . ITEMS_TABLE , null , newItem ) ; } catch ( Exception e ) { Log . e ( "Error<seq2seq4repair_space>inserting<seq2seq4repair_space>rows<seq2seq4repair_space>" , e . toString ( ) ) ; e . printStackTrace ( ) ; } Cursor c = database . rawQuery ( "SELECT<seq2seq4repair_space>last_insert_rowid()" , null ) ; c . moveToFirst ( ) ; long id = c . getLong ( 0 ) ; item . setId ( id ) ; c . close ( ) ; } public void addCategory ( Category category ) { } public void updateCategoryName ( Category category ) { } public void addOrder ( Order order ) { } public void deleteCategory ( Category category ) { } public void deleteItem ( Item item ) { } public int deleteAllOrders ( ) { } public ArrayList < Item > getItems ( Category category ) { } private void populateCategories ( ) { } private Item cursorToItem ( Cursor cursor ) { } private Category cursorToCategory ( Cursor cursor ) { } public class SQLHelper extends SQLiteOpenHelper { public SQLHelper ( ) { } @ Override public void onCreate ( SQLiteDatabase database ) { } @ Override public void onUpgrade ( SQLiteDatabase database , int oldVersion , int newVersion ) { } } }

Fix:
newItem . put ( ItemsDataSource . COLUMN_ITEM_CATEGORY_ID , item . getCategory ( ) . getId ( ) ) ;