mysql - RDBMS to OOP, SQL to Java using JDBC -
so i'm developing linkedin-style social network in java (jsp , servlets) , sql. , have use jdbc. think sql strong , understand how database operates. trying implement oo principles on data makes me think i'm doing wrong.
in database have these tables: profiles, profile_education , profile_experience. profiles contains name, location, dob, etc. other 2 tables use profiles_id foreign key , designed user able enter multiple records (i.e. more 1 job experience).
but when comes java i'm confused. should have separate classes profiles, education , experience? below attempt @ coding based on database. feel i'm writing waaaay code. need make getters , setters every variable database? here's attempt @ writing profile class:
import java.util.arraylist; import java.util.list; public class profile { private int id; private string first_name; private string last_name; private list<education> educationlist = new arraylist<education>(); private list<experience> experiencelist = new arraylist<experience>(); private list<skills> skilllist = new arraylist<skills>(); i appreciate feedback can get.
but when comes java i'm confused. should have separate classes profiles, education , experience?
i go separate classes well.
do need make getters , setters every variable database?
no every variable in da-/domainobjects.
apart that, implementation looks reasonable me.
and yes, boilerplate code part of game in case.
Comments
Post a Comment