1

I was asked this question by one of my superiors. The usual operations we do on database table from Service layer in java is Create, Update, Retrieve, Delete. These operations are basically services, so is that is the reason why they call it as Service layer also can we call all the CRUD operations as service methods?

1

Sometimes when people do this (abstract the SQL layer) it's because they want to (maybe in the future) use multiple database backends (with their own code).

Sometimes, it's as a result of a framework abstraction which occurs for the same reason - i.e. those developing the framework want to promise "all things to all men" - i.e. don't worry about SQL - we'll take care of that for you.

See this thread in response to a related question (in particular the accepted answer and also mine) - the perils of database "abstraction layers" - basically they lead to "lowest common denominatorism".

Using these for standard CRUD operations can make sense, but it's when you start trying to optimise complex queries (big differences between different servers) that these "panaceas" become worse than the illness they're trying to cure (my database is sick - i.e. slow).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.