Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes MVC  architecture. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic
Author

MVC architecture.

Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455
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


SCJP, SCWCD, SCBCD, Oracle Certified Professional (SQL n PL/SQL)
Andy Bowes
Ranch Hand

Joined: Jan 14, 2003
Posts: 171
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


Andy Bowes<br />SCJP, SCWCD<br />I like deadlines, I love the whoosing noise they make as they go flying past - Douglas Adams
Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455
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

Joined: Sep 29, 2000
Posts: 8521
Continue the conversation here.


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: MVC architecture.
 
Similar Threads
where should i create the database connection
jdbc and nearly global variables question
Topic: Struts and MVC. Question: how usually are working you?
why bean class called as BEAN
MVC architecture.