Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: biske on August 22, 2009, 09:27:03 pm
-
I have for example two tables books(book_id(PK), name) and rental_books(rental_id (PK), book_id, date).
It's on the data diagram of course. I linked tables books and rental_books where books is parent and rental_books is child. Then i press right click on relationship and then "Foreign Keys..". In the form Foreign Key Constraint i choose book_id from books and book_id form rental_books and i get error "Destination column(s) is not part of the primary key or is not unique". But i don't want that book_id is part of the primary key in table rental_books. Also it has to be that i can rent book more times, not just once so it can't be unique..How to solve it?
-
Verify that the two tables have a DBMS assigned (and the same one of course). Use the Properties dialog.
You should also check the Settings | Database Datatypes dialog to confirm that there is a default database. The way the dialog works is a bit strange (but Sparx has not improved it despite feature requests). You need to set a DBMS in the drop-down list, then look to see if the check box for default becomes checked. [Of course you can check the box yourself after selecting a DBMS, which changes the default to your selection.]
HTH, David
-
I did what you said but have same problem. Maybe i wrong with direction of association?
-
Perhaps.
Check that the diagram you created is a Data Model diagram, not simply a class (logical) diagram. EA is sensitive to the diagram type.
-
I see in another of your posts that you are still using Build 815. I think the above suggestions also apply though.
-
I have dialup internet, so can not download it. I will try to download in some other way.
I attached my model on rapidshare so you can look and see what is problem. Here is adress:
http://rapidshare.com/files/270324979/Biblioteka_v2.6.3.rar.html
Try to link and make foreign key between tables BIBLIOTEKAR and IZNAJMLJIVANJE_KNJIGE.
-
The data modeling profile is very particular. I created the primary/foreign key link without the error message. I did get the error when I didn't specify the cardinality and directionality of the association. Here's the exact procedure I used. You will need to try it and let us know if this is the result you are trying to achieve.
1. Dropped the BIBLIOTEKAR and IZNAJMLJIVANJE_KNJIGE onto an empty data model diagram.
2. Added the column sifa_bibliotekara as LONG to IZNAJMLJIVANJE_KNJIGE
2. Created a directed association starting from IZNAJMLJIVANJE_KNJIGE to BIBLIOTEKAR
3. Set the cardinality at the IZNAJMLJIVANJE_KNJIGE end to 0..*
4. Set the cardinality at the BIBLIOTEKAR end to 1
5. Right clicked on the assoication and chose foreign keys.
6. I choose the sifa_bibliotekara column for both tables
7. The foreign key constraint was created on table IZNAJMLJIVANJE_KNJIGE
Stan.
-
ok, it works. but i thought that i have to create directed association starting from BIBLIOTEKAR to IZNAJMLJIVANJE_KNJIGE because BIBLIOTEKAR is parent, IZNAJMLJIVANJE_KNJIGE is child.
-
In UML usually the child points to the parent as teh parent can stand for it's own, and the child is dependent from the parent.
That's different from most ERD diagramming utilities (like ErWin).
-
You are right, it's my first project for database in UML, and last project i worked in ERwin..Thanks again.
-
In UML usually the child points to the parent as the parent can stand for it's own, and the child is dependent from the parent.
That's different from most ERD diagramming utilities (like ERWin).
And also because, in the main, in UML the destination is the "Supplier" and the origin the "Client".
Embarcadero ER/Studio also requires that you select the "parent" first and the "child" second.
Paolo