Saturday, 15 February 2014

java - what should be the correct format of using anotation @repository in DAO layer? -



java - what should be the correct format of using anotation @repository in DAO layer? -

is @repository or @repository("daoname") ?

which appropriate? why?

and

one major uncertainty regarding update , delete method in dao layer! safe have logics in dao layer?

i mean, eg: dao layer

@transactional public void deletemethod(list list) { for(list) { deletenamedquery(list); } }

@repository public class userdao {}

in case bean if perform <context:component-scan base-package="your.package" /> named "userdao"

@repository("userrepository") public class userdao {}

instead in case named "userrepository". in few words appropriate both solution, depends how utilize it.

i suggest not add together business logic within dao maintain separation of concern. see link, in add-on

a info access object (dao) object provides abstract interface type of database or other persistence mechanism.

see link

java spring dao

No comments:

Post a Comment