Hilton D
Active Coder
I'm attempting to set up a new database architecture now that we've opted to use Hibernate. Previously, I had the three classes shown below in my Java code.
Super Class:
And a few more to come. This seems to function properly. However, I am beginning to become perplexed. The subclasses in are relationships, and some card is a card. However, I am unable to translate this into database tables.
A card sub class:
To include the procedure of a card table in the database, for example, I could create a table for each subclass type, and inside this table, I could have an id that refers a card table (which is generated when a user registers). But does this indicate that I've changed the is a relationship in my database to has a? (as done in this example) The subclass now has a card instead of being a card.
I'm perplexed and hoping that someone can help me understand.
Thanks
Super Class:
Code:
public abstract class Card {
private String firstname;
private String lastname;
private String email;
...
}
A card sub class:
Code:
public class ContactCard extends Card{
private String variable1;
private String variable2;
private String variable3;
public ContactCard(){
super(firstname, lastname, email);
...
}
}
I'm perplexed and hoping that someone can help me understand.
Thanks