File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
    Bookmark Topic Watch Topic
  • New Topic

MVC architecture.

 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
hi,
is it a right practice to use the same bean for doing database manipulation and storage ??? i mean, does it affect performace if i use a bean for database access and the same bean for setters and getters ?? or shld i used one bean for database related things and another bean for getters and setters ??? i think making confusion !! ..
not sure if this is the right forum to post this message..if therez any other forum for MVC architecture , plz gimme the url..
thanks
raj
 
Andy Bowes
Ranch Hand
Posts: 171
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't post to more than one forum. Cross-posting just makes following the threads of discussion so much harder.
The problem that you are talking about is not really MVC architecture at all and is really about database access design patterns.
The patterns that you are applying are well-known and well-defined. In my opinion you should create 2 separate classes:-
The first class would be a Value Object which is basically just a plain old Java bean with the getters & setters.
The second class is a Data Access Object which instantiates the Value Objects by appling SQL SELECT statements against the database and handles the UPDATE, INSERT and DELETE statements.
Hope this helps
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
hi andy,
thanks for ur expert answer..im really sorry for posting my message in jsp and servlets forum..i didnt know where to post my message so just thought to put it in both forums...anyway i wont repeat it..
thanks
raj
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Continue the conversation here.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic