• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Java Confused with potential is a and is involved in a relationship.

Hilton D

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:

public abstract class Card {
    private String firstname;
    private String lastname;
    private String email;
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:

public class ContactCard extends Card{
    private String variable1;
    private String variable2;
    private String variable3;

    public ContactCard(){

        super(firstname, lastname, email);
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.
Top Bottom