2013年9月20日星期五

SSH integration Dao how design

SSH integration Dao layer defines how
I see a lot of tutorials on all interfaces for each entity corresponds to a dao and then put him to achieve .
I now want to ask :
Since Dao is interact with the database , ie CRUD these features.
Why not just write a generic Dao ( generic ) , and then in the business layer in the concrete realization of the function of each entity ?
Please heroes who help to talk about the truth

------ Solution ------------------------------------ --------
can , ah, so you can write the project development time . But so written , will increase the coupling between classes is not conducive to maintenance . I recently developed projects in such a way that you say , development relatively easy .
------ Solution ---------------------------------------- ----
you say just want to just write a dao base class of ? then you maintain this base class will be very difficult, and the division will develop a variety of problems . coupling is very high, maintainability is very low. for example, now you want to modify a sql operation, but you can only modify the base class inside the operation, but these changes will affect all modules where the method is called .
------ For reference only ---------------------------------------
different service layers , with the different DAO, to correspond to a different table to do CRUD,
------ For reference only -------------------------- -------------
different tables corresponding to different Dao layer and the interface so that code reuse is not minimized yet
Spring inject the contents of the page is not increased yet

------ For reference only ---------------------------------- -----
Dao layer maintenance ? What does it mean ah. . . Is not that CRUD you ~ ~ ~ maintenance in the business layer is not better?
------ For reference only -------------------------------------- -

------ For reference only - --------------------------------------
Dao layer maintenance ? What does it mean ah. . . Is not that CRUD you ~ ~ ~ maintenance in the business layer is not better?   For example, you want to replace the operating framework for the database , how to change ? Dao layer you want to change it ? dao layer changes, those who inherit this common dao the class have to be changed , use this dao public classes that layer have to be changed , an engine body ah. . . And if it is , then the interface is not the same .
------ For reference only -------------------------------------- -

change framework does not take into account this factor ( first determine the actual project is not a good use of technology before we start coding it ) .
In fact, I said maintenance means a period of time after the project is completed , the customer may business needs to be some changes, but not to the point of replacing frame ~ ~ ~
real business projects for the framework it is not realistic or is not in place in the early research needs
where you go to work ah
changing framework conditions frequently do ?

------ For reference only ---------------------------------- -----
quote wrong , sorry

------ For reference only ---------------------------------- -----
lot of time to write a generic dao layer and then to invoke the execution , so is possible ,
------ For reference only ---------- -----------------------------
you want to say is to write a BaseDAO, then implement basic CRUD it ? Such maintenance is not very good, or separately write dao interface is better ,
------ For reference only -------------------- -------------------
Thank you for your response ~ rookie teachable friends ~ ~ ~ Results posted

began to work the ~ ~

没有评论:

发表评论