i writing restful services using spring , hibernate. read many resource in internet, did not clarify doubts. please explain me in details dao, dto , service layers in spring framework? , concern use these layers in spring develop restfull api services.
first off, these concepts platform agnostic , not exclusive spring framework or other framework, matter.
data transfer object
dto
object carries data between processes. when you're working remote interface, each call expensive. result need reduce number of calls. solution create data transfer object
can hold data call. needs serializable go across connection. assembler used on server side transfer data between dto
, domain objects. it's little more bunch of fields , getters , setters them.
data access object
a data access object
abstracts , encapsulates access data source. dao
manages connection data source obtain , store data.
the dao implements access mechanism required work data source. data source persistent store rdbms
, or business service accessed via rest
or soap
.
the dao
abstracts underlying data access implementation service
objects enable transparent access data source. service
delegates data load , store operations dao
.
service
service
objects doing work application needs domain you're working with. involves calculations based on inputs , stored data, validation of data comes in presentation, , figuring out data source logic dispatch, depending on commands received presentation.
a service layer
defines application's boundary , set of available operations perspective of interfacing client layers. encapsulates application's business logic, controlling transactions , coordinating responses in implementation of operations.
recommended references
martin fowler has great book on common application architecture patterns named patterns of enterprise application architecture. there also, core j2ee patterns worth looking at.
Comments
Post a Comment