All the SQL in my app... Should I be confining it to its own special class? For example a MyDatabase class that extends SQLiteOpenHelper and implements all the create-tables, defines all the table names, column names, queries, holds all the CRUD methods for all my objects, etc. Or should I be putting all this stuff in the actual objects themselves and have all my objects implement some common interface like DatabaseModel where all DatabaseModels implement things like create, save, delete, onCreate, onUpgrade, etc? What do people choose and why?I want to know how most people handle create/update. In my case I have my objects contain many of the same members that they do in the SQL database. For example a Player object might have an id, name, about-me text, etc. That id would correspond to the auto-incremented id in the database. But in the app, when you're first filling in the data for that object, it doesn't exist in the database yet, so I default it to an id of -1. Then if someone wants to save the object, I have it check if the id is negative, and if so, I create it in the database and assign the object that id immediately in the SQL method. Otherwise it is an update and it'll have the correct id anyway. Is this what most people do? Is this a sound decision?If anyone does answer, please provide some kind of example of what you mean.
Java/Android CRUD SQL design
java;design;sql;android;crud