0

I create a service class which contain the following method

selectAll() return Obj Array
selectOne(); return Obj Array
insert(Obj); return int
delete(); return int
update(); return int

I want to make this class generic as Controller can pass any object while invoking the method., without the reality that properties varies from one beans to another.

Both FM
  • 770
  • 1
  • 14
  • 33

1 Answers1

1

Your controllers shouldn't know about the database tables anyways. Your controller should hit some business service layer, which should in turn hit some database layer.

Try to organize your database layer in terms of the domain object. i.e: have a class that persists an object like "Department" or "catagory" regardless how many tables that object touches.

Chao
  • 1,058
  • 7
  • 12