I'm building an address book API, where a user can input multiple contact names, phone numbers, and addresses.
My database structure would be as follows:
create table user (
id int not null primary key,
first_name varchar(100) not null,
last_name varchar(100) not null,
email_address varchar(100) not null );
create table contact (
id int not null primary key,
user_id int not null,
first_name varchar(100) not null,
last_name varchar(100) not null,
mobile_phone_number varchar(10),
business_phone_number varchar(10),
organization varchar(100),
address_street_number varchar(10),
address_street_name varchar(100),
address_city varchar(100),
address_state varchar(100),
foreign key(user_id) references user(id) );
With an entity framework like JPA, I can represent each table as an object, and each column as a field in the object.
Would that be bad OO design? What are some best practices around modeling these tables into objects?