CRUD operations on different tables with single method for Android
I have number of tables in my database. There will be number of methods in DB class if i write a crud operations for e开发者_如何转开发very table.
If i can pass name of Table on insertMethod, updateMethod & deleteMethod. Then operation should be performed on that table only.
By this way there will be only 3 methods in DB class and code would be much cleanier.
Does any one have such implementation before in Android?
Thanks, Zoombie
You may find the concept of Generic Data Access Objects interesting. You can find an example for hibernate here. With a quick google search you can also find GenericDAO for Android SQLite (did not test it!).
精彩评论