entity-relationship

Relationship in ER model

走远了吗. 提交于 2019-12-13 06:59:51
问题 I am learning about ER modelling about Database systems. My problem is that there is a entity called books,enitity named user and I want to create a borrows relationship between user and book with attribute issue date. I modelled it as described but it was pointed that borrows cannot be a relationship because a same user can borrow a book twice. Can anybody explain me what this is as I am using issue data as an attribute so records in borrows relationship would not collide as I will use PK as

Many to many with implied and explicit relationships

微笑、不失礼 提交于 2019-12-13 04:01:31
问题 I have a standard many-to-many relationship in my database between Person and Widget. A Person in an administrative role has access to ALL Widgets. In my application, I want to see which Widgets a Person has access to. I have two high level options: Explicitly manage the relationships. When a Person becomes an administrator, relate that Person to all existing Widgets. When a Widget is created, relate that Widget to all existing administrators. At run-time, if the Person is an administrator,

Entity Relationship Diagram - Entity which can have multiple types

雨燕双飞 提交于 2019-12-13 03:59:09
问题 How can I represent an Album entity which can be vinyl and/or cd and/or tape. I assume those can't be declared as subtypes of the Album entity as there would be no way the album could be all of them. Should it be a multivalue attribute of the Album entity? Also each type vinyl, cd, tape have different attributes (eg. vinyl might have colour, cd might have an associated video clip etc.) And for an Artist entity how could I make a solo artist and a group artist? At the minute I have an Artist

entity framework 4, code-only, relationships

寵の児 提交于 2019-12-13 03:39:30
问题 I can't figure out how to solve the following problem. What i need it a relationship from one base class to another, so that every derived class has a relationship with the same table, called 'Item' in my example. Since this is just an example it doesn't reflect my program. In the real program the relationship with class Item is in a different namespace. Therefore it can't be in the derived class. The error: A key is registered for the derived type 'WebApplication1.Client'. Keys must be

how to make sure that product specs is for the category entity?

余生颓废 提交于 2019-12-13 03:27:13
问题 I have the following table: products (id, name, price, category_id) categories (id, name, description) now because each category's products may have different attributes than other category's product I want to use EVA but here is my problem: I want to make sure that any product attribute's value is being added belong to the category of that product and not allowing the addition of arrtibutes that does not belong to it. would you please tell me how to do this? 回答1: I want to make sure that any

What is the right way to use Associative Entity?

。_饼干妹妹 提交于 2019-12-13 03:11:23
问题 This is the description: Draw an Entity-Relationship diagram for Poke-Hospital which provides medical service to pokemon. Each pokemon has an appointment with one of the nurse Joys. In addition to recording the name, type and trainer of each pokemon, the system needs to keep track of the multiple types of sickness being diagnosed for the pokemon. During an appointment, the nurse will always prescribe medicine. It is required to record the date, time and dosage of the medicine. A pokemon may

Are tables with the same attributes but different relationships bad practice?

与世无争的帅哥 提交于 2019-12-13 02:26:00
问题 Is it bad to have two tables with the same attributes but with different meanings and relationships? I.e. table1 's attributes = table2 's attributes. However table1 has a relationship with table3 and table2 has a relationship with table4 . Is this considered bad practice? Or should table1 and table2 be collated into one table? Although if it were to be collated into one table wouldn't it follow that table1 would also have a relationship with table4 ? 回答1: It is ok to have tables with the

Strange JPA one-to-many behavior when trying to set the “many” on the “one” entity

久未见 提交于 2019-12-13 00:08:56
问题 I've mapped two entities using JPA (specifically Hibernate). Those entities have a one-to-many relationship (I've simplified for presentation): @Entity public class A { @ManyToOne public B getB() { return b; } } @Entity public Class B { @OneToMany(mappedBy="b") public Set<A> getAs() { return as; } } Now, I'm trying to create a relationship between two instances of these entities by using the setter of the one-side/not-owner-side of the relationship (i.e the table being referenced to): em

Database relationships using phpmyAdmin (composite keys)

我与影子孤独终老i 提交于 2019-12-12 23:32:29
问题 I am bit confused on making a good relational database. I am using phpmyAdmin to create a database. I have the following four tables. Don't worry about that fact place and price are optional they just are. Person (Mandatory) Item (Mandatory) Place (Optional) Price (Optional) Item is the main table. It will always have person linked. * I know you do joins in mysql for the tables. If I want to link the tables together I could use composite keys (using the ids from each table), however is this

How to add/remove many-to-many relation with entity framework by entity key?

跟風遠走 提交于 2019-12-12 20:54:38
问题 I tried: using (Entities e = new Entities()) { EntityKey key = new EntityKey("Entities.Users", "UserId", 20); User user = new User { EntityKey = key}; Role role = e.Roles.FirstOrDefault(); //role.Users.Attach(user); //throws (when uncommented...) InvalidOperationException: //The object being attached to the source object is not attached to the same ObjectContext as the source object. role.Users.Add(user); //throws InvalidOperationException too: //The object cannot be added to the