entity-relationship

Optional relationships in Core Data (deleting and checking)

Hi, I have a Core Data model with 2 entities: Game and ScoreTable. A Game has an optional relationship with ScoreTable. I usually check if a game has a ScoreTable by doing: NSManagedObject *scoreTable = [myGame valueForKey: @"scoreTable"]; if (scoreTable == nil) { // wtv } And when I want to delete a ScoreTable from a Game I'll j...

Whats the best free ER-modelling tool?

Hi, whats the best free entity relationship modelling tool? I have an sql server 2008 database that I want to be modelled out with fields and foreign key contraints and I dont particulary like the one which is built into SQL Management studio. ...

Doctrine relation betwen two tables

I have two tables A and B. A have one or more registers in B. I want to join two tables and extract all information about A. I do that: Schema.yml A: fields..... B: fields... relations: A: { onDelete: CASCADE, local: a.id, foreign: b.id, foreignalias: AB } And i try to do that... $q = Doctrine_Query::create() ->from...

Business logic layer, multiple tables, relationship

In the business logic we map, Tables to Objects and fields of this table to properties. What to do in one-to many relationship? Just an example: I have Table, Products and Categories. I need to drag all products and instead of Category_ID (Products table) need to display actual Category name wich is stored in Category table. What is pr...

Cocoa: Core Data relationships not working

I have a basic Core data model like this: Class -Class Name (string) Relationship: HasDetails (to many) -to Details Details -Number (int) -Name (string) Relationship: IsPartOfClass -to Class I have two table views, one for "Class" and one for "Details" and have all the bindings set up, however, when I add a new object to Details ...

MySQL inner join with 2 columns

I have one table users with 2 fields : id , name and another table friends with 2 fields : userid1 userid2 . So this means userid1 is friend with userid2 . I want , with one inner or left join to show this : userid1 name(got from users table) is friend with userid2 name(got from users table) something SELECT * FROM friends INNER JO...

Copying whole object graph - copy a relation

I have a model with 2 entities: RealEstate and Container Containers object are already saved onto the persistent store with the following hierarchy: Container 1 Container 2 Container 3 Container 4 Container 5 Container 6 Each container has a RealEstate owner (in a given hierarchy the realEstate is always the same)...

Database design issue:

Hey guys, I'm building a Volunteer Management System and I'm having some DB design issues: To explain the process: Volunteers can sign up for accounts. Volunteers report their hours to a project (each volunteer can have multiple projects). Volunteer supervisors are notified when a volunteers number of hours are close to some specified ...

NHibernate and parent/child collection mapping

Hi, I have this table containing both parent and child elements. CREATE TABLE Expenses( [BudgetId] int, [AccountGroupId] int, [AccountNumber] int, [Amount] decimal ) In my domain model it's represented by this hierachy: Budget AccountGroup ExpenseLine ExpenseLine ExpenseLine So a Budget has a collection of A...

Database modeling tool to generate E-R diagrams from schema or any other tool to visually represent the MySQL DB schema

I have inherited a mysql schema with around two dozen tables. I would like to create an E-R diagram (or some form of visual representation) from my the create table statements. I am looking for free open source tools which will help me do this. This will help me understand the schema better and aid others as well. Do people have experi...

MYSQL Workbench EER, what's different?

Hey guys, I just downloaded Mysql Workbench and noticed they use the term EER Diagram? I thought that Entity Relationship diagram were a conceptual representation of data (Conceptual schema), a bit like this: http://www.ncgia.ucsb.edu/giscc/units/u045/figures/figure1.jpg I mean, Mysql Workbench's Diagrams have tables with foreign keys a...

RIA Services and Relationships in Silverlight 3

I've finally managed to get a handle on loading information using Silverlight, ADO.NET Entities, and RIA Services, but I'm still having a problem with getting the information about the relationships. For instance, imagine a product, and that product has several categories of attributes. We'll call them ProductAreas. The Product object...

Core data many-to-many relationship - Predicate question

In my Core Data model I have two entities: List and Patient. List has an attribute called 'name'. A List can have any number of Patients and each Patient can belong to any number of different lists. I have therefore set a relationship on List called 'patients' that has an inverse to-many relationship to Patient AND a relationship on Pat...

Entity Framework 4 and validating non-persisted objects in relation collections

Hi, What is the best practice with regard to the Entity Framework and validating new objects prior to persisting them (or in other words calling .SaveChanges()) when the new object may rely on either persisted objects or other new objects? For example, consider the following: Entity1 MyEntity1 = new Entity1(); MyEntity1.Name = "Hornbl...

Is there an easier way to assign relationships to new objects in Entity Framework?

In my example, I'm trying to create a new object which has references to existing objects. I'm finding myself having to retrieve complete objects from the database in order to reference them from my new object. Apologies for any small errors in the code - I'm working from memory - I don't have my code with me. My ViewModel contains th...

Entity Framework - Merging 2 physical tables into one "virtual" table problems...

I have been reading up on porting ASP.NET Membership Provider into .NET 3.5 using LINQ & Entities. However, the DB model that every single sample shows is the newer model while I've inherited a rather old model. Differences: The User Table is split into a pair of User & Membership Tables. All of the tables in the DB are prepended...

How to relate two tables without a foreign key?

Can someone give a demo? I'm using MySQL,but the idea should be the same! EDIT In fact I'm asking what's the difference between Doctrine_Relation and Doctrine_Relation_ForeignKey in doctrine? ...

A field in a rails form to select a 'belongs_to' object

Oh so please bear with me... I have a model for bookings and a model for drivers. A driver has many bookings and a booking belongs to a driver. When adding or editing a booking, I want the user to be able to type the username of the driver. Usernames are unique and easier for the end user than giving each driver a number. Now this is h...

Foreign key onto weak entity set in MS SQL Server 2008?

I'm using Microsoft SQL Server 2008 Management Studio to create a relational schema by following an Entity-Relationship diagram. (included below; unrelated details removed) Until now, primary and foreign keys have been working as expected. But when I try to create a foreign key from the entity relationship takes onto the weak entity s...

Core Data - Breaking A Relationship

Hi, I have a Patient entity and a List entity. A Patient can belong to several different lists and a list can have several different patients. Say I have a patient who belongs to 3 lists (A, B, C). I want to remove the patient from lists A & B. I do not want to delete lists A & B themselves though obviously. How do I go about doing thi...