I understand why you need a pass a SQLiteDatabase to an annotated method. However, in my case I fail to see a good way to handle this.
I like to abstract the CRUD on a table using a manager class. This class owns the SQLiteHelper instance and also instantiates readable/writable databases. If I use the annotation this means that I have to either instantiate them outside the manager class, or I have to expose another method like this:
Device add(Device device) {
return add(sqliteHelper.getWritableDatabase(), device);
}
@Transactional
Device add(SQLiteDatabase db, Device device) {
// ...
return device;
}
How do you guys use it or what are the best practices?