basically im asking if theres another way in which I can create foreign key despite the fact that I cant make the relations by simply having the characters of a primary in another table or by setting those certain characters to be that of a foreign key
OK, I've finally got Netbeans running and connecting to a local (embedded) database that I created manually with IJ, so I've got a handle on what you are talking about. As it happens, there is a way to add a foreign key to a table in Netbeans, but it isn't quite intuitive.
What you need to do is create the attribute (that is, the field) you are going to use as a foreign key in the table you are relating, making sure it is the same type as the key of the table it relates to. Then, after you have saved the table, you go to the table's etry under the database, and open the tree node so that it shows the indexes and foreign keys. Right click on foreign keys and select Execute Command. You then would code an ALTER TABLE statement in the Command window to add the FK constraint.
For example, in the database I created, I have a table State with a NUMERIC primary key id, and a twoCHAR field state for the abbreviations of the US states. In another table, Address, I have a NUMERIC key state which I will set a foreign key constraint on:
ALTER TABLE APP.Address
ADD CONSTRAINT address_state_fk
FOREIGN KEY (state)
REFERENCES State (id)
I then hit 'SQL Execute' to add the constraint.
There may be any easier way to do this, but this way does work.
And btw I'd also just like to mention that the problem isn't the fact that I have both of the columns as primary keys as illustrated in the properties because I even tried using one of them as a primary and the other as just an index.....here are the contents of the database tables in case they might be needed.
Its alright thanks I really appreciate you trying........I need help with safely deleting an entity class though because for some reason I'm not using some of my entiity classes when I try to delete them its just making the situation worse.
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...
Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...