entity-relationship

EF SaveChanges() - id vs loaded object to ForeignKey

I found strange thing. For example I have Order and Item entity. Item is reference on Order by id. In EF to save Item, I need firstly load Order, and put it to reference field? Is this only way? Order order = data.OrderSet.FirstOrDefault(b => b.OrderID == OrderId); Item item = new Item { order = order }; data.Add...

Tracking a Change on a Column

I recently ran across a very interesting problem involving database design. I have changed the table names to simplify the problem, so let me describe it as such: I have 2 tables, fruit and vegetable each stores whether or not a fruit or vegetable is tasty. Now lets say that someone keeps changing the IsTasty setting through the UI of m...

Is there a nosql store that also allows for relationships between stored entities?

I am looking for nosql key value stores that also provide for storing/maintaining relationships between stored entities. I know Google App Engine's datastore allows for owned and unowned relationships between entities. Does any of the popular nosql store's provide something similar? Even though most of them are schema less, are there m...

Complex relationships with multiple LINQ

After a long thought we found that the best approach for our needs would be to use multiple tables as if it was classes, so we have something like: tblPerson (pk code) tblWorker (pk codePerson) tblPhone (pk code, fk codePerson) tblAddress (pk code, fk codePerson) it's almost like classes. It was really necessary because many tables do...

How does ORM solve bidirectional relationship between entities (NHibernate, for example)?

I'm writing a homework for my RDBMS class, I need to perform CRUD operations on quite simple domain, which is cyber sport championship. Students are required to use ADO.NET. My question is how can I solve bidirectional relationship, for example 1:m (every championship has many matches, but every match belongs to only one exact championsh...

Entity Framework - joining nulls - NullReferenceException was unhandled by user code

I am writing an asp.net mvc application to learn Entity Framework with and am running into an issue that I do not know how to handle. For simplicity lets take the following table structure: Movie ID (int, not null, auto increment) Name (varchar) GenreID (int) and Genre ID (int, not null, auto increment) Name (varchar) M...

Weird Constraint Exception with entity framework

I'm new to the Entities framework. One week earlier I've hit the common problem of the currentcontext that throws exception if used in a non-unique manner, but that was fixed. Today I have a new problem, a really new one because I do not even know why this is happening since I do think that I have the same code. Here is the error that ...

What kind of different relationships do I have to think about?

I'm sure that I missed something, and that I've got something plain wrong. 1:(0-1) (one to zero or one) 1:1 (one to one) 1:(0-n) (one to zero, one or many) (0-m):(0-n) (zero, one or many to zero, one or many) m:n (many to many) m:1 (many to one) m:(0-1) (many to zero or one, i.e. 10 people share one meeting room) Constrained Rela...

Database Relationship in JSP like Ruby-on-Rails

In ruby on rails we can specify many Database relations line belongs_to, has_many, and this make coding a lot simpler. But is there any such database relationship APIs that brings such coding ease to JSP. I'm pretty new to JSP. But you can relate any code with ROR. ...

How can I display the 1 to many and many to 1 relationship in RoR?

I have a table called "order" which has many "order_items" , each "order_items" is belongs_to "order" and "product". In the db, I have one record in order. the record is like this: orders table: id = 1 name= customer and the order_items table is like this: id=1 product_id=233 order_id =1 id=2 product_id=454 order_id =1 I have the ...

Getting 5level relation with one mysql query

Hi folks.Thank u a lot for your answers beforehand. I need to make a such thing I have a table friendship (id,user_id,friend_id,status,timestamp) So lets say I am a user with user_id=43 and I am visiting a user with user_id=15 In the profile it should be a connection line of friendships Let me describe ... lets say I have...

Normalization Help

I am refactoring an old Oracle 10g schema to try to introduce some normalization. In one of the larger tables, there is a text field that has at most, 10-15 possible values. In my mind, it seems that this field is an example of unnecessary data duplication and should be extracted to a separate table. After examining the data, I cannot...

Diffrence between getting information from database about OneToMany and ManyToMany Relationships

Hello, everyone I'm currently working a relationship Tree for a given GUID. i'm working on Dynamic CRM 4, C# and a SQL 2005 database. i have done the mapping, but one of the requirments is that near the name of each related entity, i will also add the description of the relation as defined in the CRM. since the description name cannot ...

How do I model relative scores between entities in CoreData

I am new to CoreData and am struggling to work out the correct way to model a particular relationship. I have an entity called 'Friend' with a few attributes such as 'name', 'age', 'sex' etc. I would like to be able to model a score between two instances of Friend and am having trouble getting my head around the best way to do this. Fo...

Restful Authentication -- Relating User ID to Profile

Hey Guys, I'm new to Ruby on Rails...I've been playing around with developing a social networking type app....I just added Restful Authentication to my app successfully..Now I would like to create a model/controller where each User once logged in can create/edit their own profile. So I created the model and controller...the code in th...

Fetching relations with Core Data

Hi, I have two managed objects which have a bidirectional relationship. It is a 'segmentWithDetails' which contains a 'segment' object. I use NSEntityDescription *entity = [NSEntityDescription entityForName:@"SegmentWithDetails" inManagedObjectContext:connectionDetailsService.connectionDetai...

Is there any wrong in my object relationship?

I want which order have different order status, so I have a table called "status", in the status.rb, it likes this: class Status < ActiveRecord::Base belongs_to :order attr_accessible :name end And this is my order.rb: class Order < ActiveRecord::Base has_one :statuses end In my view, I try to call the related status like t...

Objects / Entities: Many to Many + Many to One

Users / \ / \ M-T-O M-T-O / \ / \ Products----M-T-M----Tags I wonder if there is any documentation on how to create a schema like this with entities. I got stuck at wondering which entity should be responsible for what in the relation. ...

How do I get the ERM Diagram for Fiserv (PCS) Vision core banking software?

Vision is a banking CRM created by PCS (now Fiserv). Vision uses a progress database. I need the entity-relationship model diagram. ...

Design question: Filterable attributes, SQL

I have two tables in my database, Operation and Equipment. An operation requires zero or more attributes. However, there's some logic in how the attributes are attributed: Operation Foo requires equipment A and B Operation Bar requires no equipment Operation Baz requires equipment B and either C or D Operation Quux requires equipment (...