entity-relationship

EF CTP4: For Code Only, no database generation needed, how much DB info is needed?

I have a database, and I have entity POCO's, and all I want to use EF for is to map between the two and keep track of changes for loading, saving, etc. I have been reading a lot of the literature (such as it is) on "Code First", and I am unclear on how much of the database information I need to supply when there is not going to be a dat...

Entity Framwork 4.0 Relationship map table

I have these tables; Customer - CustomerID (primary key) - Name Car - CarID (primary key) - Model Customer_Car_Map (composite primary key CustomerID and CarID) - CustomerID (foreign key to Customer.CustomerID) - CarID (foreign key to Car.CarID) When I generate the models from the database using EF4, it generates classes for all tabl...

add<Key>Object vs insertNewObjectForEntityForName Core Data Relationships

Hi, Although I have a lot of experience in database development, I'm having a hard time conceptualizing linking relationships in Core Data. As I understand it, the many relationship is an NSSet attached to the one file. After reading the documentation, I've understood part of it and gotten it to work in the first import in my code bel...

EF CTP4: How to tell EF a column is NOT identity

I have a code-first, POCO project in which I am trying to adjust an existing database so that it syncs up with what EF is expecting, given my existing model. I have these entities: public class FlaggedDate { [Key] public long scheduledDayID { get; set; } [Required] public DateTime date { get; set; } [StringLength(50...

Guidance on Database Design for CakePHP

I'm developing an application using the CakePHP framework and am currently in the process of designing the database. I want to make sure that I design the objects and their associations correctly so that the application performs well, is organized properly, is extensible, and scales well. I will first describe the application in detail, ...

A tool to automatically generate a UML diagram for a Rails Application

Looking for a good tool/gem that can automatically generate a nice looking UML diagram for an existing rails application. (Im imagining such a tool would read the schema.rb file and then scan the models for relationships) ...

EJB3/JPA entity with an aggregated attribute

Hi all, I wanted to know if there is a way to get in a One2Many relationship a field of the One side that is an aggregate of the Many side. Let's take the following example: @Entity public class A { @Id private Long id; @OneToMany (mappedBy="parentA") private Collection<B> allBs; // Here I don't know how to Map the latest B by d...

Why is Session.Flush() required to persist relationships?

I have two entities, a Shelf and a Product: public class Shelf { public virtual IList<Product> Products { get; set; } public Shelf() { Products = new List<Product>(); } } public class Product { public virtual string Name { get; set; } } Basically put, a Shelf can contain many Products, and a Product can b...

Database schema design for schedules

Hi! I have two tables: Companies and Employees. I also have a relation table Employs which contains the foreign keys company_id, employee_id as a composite primary key. Note: employees can work at multiple companies. I would like to have another table EmployeeSchedules which simply contains schedules (company_id:integer,employee_id:in...

Creating a Relation in __init__ of a model (in Django)

Lets assume I had the following Model class A(Models.model): def __init__(self,data): B(a=self,data=data).save() class B(Models.model): data = somefieldtype a = Models.models.ForeignKey('A') now as you might suspect, there is an error in this Model definintion, as one cannot create a relation to the A instance before a...

Do I need to model a dependency explicitly in an ER diagram?

I was looking at ER diagrams today. If we consider two entities, Item and Member in the context of a rental shop, the member can either checkout an item or renew the item. So for this, I came up with the following: The idea was that a member can check out any number of items but an item can be checked out only once. And, a member can ...

EntityFramework mappings - what is wrong with this mapping?

I'm kind of stuck working out where I'm going wrong with the below entity framework mapping. What I've done is: a) created a Sqlite database (see below, noting Sqlite doesn't allow FK constraints) b) created a blank Entity Data Mode & then created the model from the database c) issue is then trying to add the Model association so it pi...

What is the difference in ECore between containment and reference?

When creating references between ECore entities there is the possibility to mark a reference as "containment". Can somebody explain me in easy words what's the difference between a plain reference and a containment? The definitions and explainations I found so far didn't do the trick for me. ...

How enable or disable Entity validation.

I use Entity Framework 4 and MVC 2. I Have an Address Entity, Contact, Company. There are a relation between Contact and Address and Company and Address.. A Contact can Have an Address and a Company can also have an address too. I created a Partial View for Address. <div class="editor"> <%: Html.HiddenFor(model => model.Ad...

How to model core-data relationship, one-to-one or one-to-many?

I have Customer object and Loan object. It is a one-to-many relationship (Customer <-->> Loan). Each loan has exactly 5 type of Payoff plans (exactly 5 and will not change for the next 100 years) for customer to select and to see the payment projection. Each Payoff plan consist of type, initial-payment, monthly-payment, interest, number-...

CoreData: deleteObject faults on relationships when nil.

We have a project that has two one to many relationships. We encounter a core data fault when we try to delete the parent object. This ONLY happens if the child relationships are empty. So for example: A project has many to-dos and messages. If we create a project and add a message and a to-do to it, and subsequently call deleteObject o...

Table foreign key / association to itself?

Hi, I've got a table that stores inventory for a store that looks like this InventoryId int ParentId int ShortDesc int ... [other product data] ... A TShirt will exist in the table with a ParentId of -1. Any variations of size and colour will exist in the same table with the original parent InventoryID in the ParentID f...

Primary Key and ER models

Say i have an ER model _____________ | E2 | |_____________| | | | | | | A21* A22 A23* where the A21 and A23 are primary keys. Would this mean the primary key for E2 will be PRIMARY KEY(A21, A23)? If so, then what is the difference of the diagram below. _____________ | E2 | |_____________| | ...

Many to many relationship in erd

I am creating database for entertainment application. In this movies,video songs,mp3 songs like entities are included. In this movie & actors,actresses,music directors,male singers, female singers have many to many relationships. i.e. an actor works in zero or many movies & a movie includes one or many actors. so my question is how to ma...

How to create related records with Doctrine PHP

Hello I have modeled two classes with a many to many relationship : User and Conversation, and I can't create a the link between these two classes when I use them : class User extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('udid', 'string', 255); $this->hasColumn('nb_requetes', 'integ...