relationship

SQL - Multiplie one-to-many relationships

Is it possible somehow to do multiplie one-to-many relationships between 2 tables? Like: Table abc abcID defID message Table def defID abcID message If yes how can I then make a new abc entry with the entity framework? ...

In database design what do "n:m" and "1:n" mean?

Title says it all :) Thanks ;) ...

Doctrine 2 tables sharing multiple relationships

Is it possible in Doctrine for 2 tables to share more than one relationship based on different columns? Also does Doctrine support a ternary relationship? Thanks in Advance ...

NSPredicate filter the data via relationship rather than a property

Here is my question. I have this model one [Event] has multiple [Day] and there is a relationship called days in [Event] and there is a reverse relationship event in [Day]. Now I want pass the Event object and get all days using NSFetchedResultsController and feed all days in the table. Here is my code: // Create the fetch request for ...

Authlogic, multiple user types and multiple relations between the same models

Good morning, I'm trying to figure out the best way to manage this user situation I've got. I have users and affiliates. There is already a HABTM relationship between the two of them, because users can sign up for affiliates, and affiliates can reach out and touch users, in order to get various data points. Now I need to set up a new...

SQL transform semi-colon list into relationship table

I currently have a code table containing a list of types (Type_ID, Description), but they are saved in another table as ID;;ID;;ID...etc I am looking for a script that will take those ID's and place them in a relationship table corresponding to there Type ID For example in table A the Type_ID entries could look like: 1;;2;;4 1 ...

JPA - Removing of elements of a bidirectional Relationship

Why can i remove elements of a bidirectional relation although only one side of the relation is managed in persistence context (Example I)? When i have an unidirectional Relationship that doesn't work (see Example II). Why? Entities: @Entity Class User { ... @OneToMany(mappedBy = "user") private List<Process> processes; ...

iPhone Core Data - How to show selected records based on parent relationship?

Using Core Data. Let's say we have models for Team and Player. Assume: -Each player is a member of a single team -Relevant relationships have been made in a xcdatamodel file. I have a TeamListViewController (listing all teams), when I select a team I want to see a list of just those players related to that selected team on the PlayerLi...

Hibernate+JPA One To One relationship

I have a OneToOne relationship like this :- Person Others ----------- ------------- | id (PK) | <----------------->| id(PK)(FK) | ----------- ------------- | name | |.... | | address | |.... | | .... | ...

Core data relationship count update

I have a core data model with blog groups, blogs, and posts. A blog group has a to-many relationship to blogs, and each blog has a to-many relationship to posts. A post has an attribute "hasBeenRead." Both the blog and the blog group have a attributes "numberUnreadPosts." I'd like to know the best practice for propagating the numbe...

Grails many-to-many relationship

Hi, I'm trying to do a many-to-many relationship on Grails 1.3.4 and I'm getting this exception: Caused by: org.codehaus.groovy.grails.exceptions.GrailsDomainException: No owner defined between domain classes [class gblog.Post] and [class gblog.Comentario] in a many-to-many relationship. Example: static belongsTo = gblog.Comentario ...

How do I achieve the effect of two to-many relationships to the same entity from one entity?

I am having a hard time wrapping my head around data models. Let me start with showing how I would declare the class if I just had to have in-memory objects. @interface PlayerState { NSSet /* of SavedDie */ *savedDice; NSSet /* of SavedDie */ *immediateRolls; } @property (nonatomic, retain) NSSet *savedDice; @property (nonatomic,...

Parent-child relationship: multiple tables vs. self-join

I'm working on a database for stat keeping for a sports club where I help administrate some events. I think I've got the parts for keeping track of the competitor names, classifications, categories, etc. figured out using a main table, several lookup tables and a couple bridge tables to cover the many-to-many relationships involved. I ...

unique pair in a "friendship" database

I'm posting this question which is somewhat a summary of my other question. I have two databases: 1) db_users. 2) db_friends. I stress that they're stored in separate databases on different servers and therefore no foreign keys can be used. In 'db_friends' I have the table 'tbl_friends' which has the following columns: - id_user - id_...

Issues with Relationships

You can take a look at the app I'm referring to at: http://github.com/585connor/QA So, I've built this question & answer app... kind of. I can get the answers to be listed on their respective questions but I cannot figure out how to get the user info to be displayed on those questions/answers. For example I'd like to put the username ne...

Rails - delete one side of a one-to-many relationship

Quick question: If I have a one-to-many relationship, such as this: class SalesPerson < ActiveRecord::Base has_many :deals end class Deal < ActiveRecord::Base belongs_to :sales_person end how can I delete a Sales Person, without negatively impacting the deals associated with them? The use-case for this would be if someone left ...

How to insert the 'answer' model?

The title may be not exactly, but I don't know how to express it. I have 3 class: User, Question, Answer. The simple code is: Session = scoped_session(sessionmaker()) Base = declarative_base() class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) questions = relationship('Question', backref="use...

GWT JDO relatioships problem - child of an object from datastore is null

Hi, I encounter problems while trying to implement GWT JDO features. Let's say there is a Data object that contains an Item object. In the datastore this would create a one-to-one relationship. The problem is that when I try to get the object from the datastore, the 'item' field is always null. Of course I put the object to the datas...

What is the best way in SQL to swap the direction of a one-to-many relationship?

Okay, so for whatever reason I have ended up with a situation where the key is pointing the wrong way in a one-to-many. It was obviously never used as a one-to-many, only as a one-to-one, and now there is a need to expand one of those to be many, and the way the key was stored this turned out to be backwards. The images table has a t...

Database design & table relationships: where would the data go? (Image included).

I need to carryout a data capture exercise, which is looking like a large task, that unfortunately may end up being done in excel. I believe a database is more suitable, but the structure of it is probably very complicated. I've created 4 categories per Unit (30 units). Each category has 8 graphs/dimensions. Each graph/dimension has a s...