java - Android Database, CRUD operations for multiple tables in MVC -



java - Android Database, CRUD operations for multiple tables in MVC -

a newbie android , trying save , view info into/from sql lite database. tables follows:

student course of study registration ------- ------ ------------ id (pk) id(pk) sid, cid (pk) name name term email credit

as far understand, model part of mvc store business logic, 'student', 'course' , 'registration' classes have get/set methods. have dbhelper class extends sqliteopenhelper , saw in many tutorial, class contains crud operations in general.

but question is, as have multiple tables work with, should place crud operations addstudent(), addcourse(), addregistration(). suppose not feasible have big dbhelper class containing crud methods in universe. in examples, have seen view operations(viewstudent() example) in mainactivity well. way it? illustration (with classes , and methods) highly appreciated.

you crud operations should in repository or dao layer.

studentrepository.save(student);

your business logic should in service layer, or in domain models, if using domain-driven design. service layer uses repository layer save , retrieve data.

studentservice.registerstudentincourse(student, course);

the models in mvc can represent non-domain models too, such loginform. different domain models in represent info view. mvc model can domain model, doesn't have be. mvc model can combine multiple domain models.

java android sqlite model-view-controller

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -