Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is this right Approach to do this in DAO?

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I am designing a web application in which there is a section which is called myprofile

I have 5 entity in my project(Admin,Employee,Student,Agent,Library)

each have different view in Output What I am thinking is when my controller call in DAO to access that I need to return that Object of above 5 types depends on arguments

What I am thinking is make 5 methods in my DAO getProfileAdmin(),getProfileEmployee()....
and change their return type as Object depending on method name


Is this right data modelling or access approach for same task of myprofile?

(I suspect no)

Thanks
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you consider using generics in your DAO interface?

For example:Using generics you don't need to use Object as a return type (and explicit casts). And generics offers you stronger type checks at compile time as well
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Roel

Thanks now it is clear in my mind
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic