• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt while doing web based app  RSS feed

 
RabiDas Sharma
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I'm creating a small java web app that will take details of students and store in database
when student signs up for the first time and next time if he/she logs in then she can
use her credentials to log in.


well, my question is after retrieving details like name,ph,address i need to store that to
database.But my Teacher says I've to retrieve content in dopost() then create student object using these details
and then store the content in database using getter and setter methods of Student class.
But I can't understand why i need to create student object and my teacher doesn't give any
convincing reason for it.
I feel no object creation is required in this kind of java based app. I need to only store in Database or
retrieve from database.
please explain me what is the need of it.
rectify me if necessary.


thanks in advance
with regards

 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Imagine that you have 64 attributes to store into 7 different tables - the code would be rather unwieldy if you did it the way your propose. Better to encapsulate knowledge of the table details (and validation etc.) into their own objects. It's a very common design to keep separate classes for each DB table.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!