many-to-many

Doctrine how to setup Many to Many to Many relationship

Summary: Using the following YML I get a reference to a FOREIGN KEY (role_id) that is not in my YML. Problem: I'm trying to create a system where there is a user (CreditName) who can belong to many role's (all of which can have many users). There are also many projects, which can contain many User+Roles, so I'd like the Project to ...

Got a table of people, who I want to link to each other, many-to-many, with the links being bidirectional

Imagine you live in very simplified example land - and imagine that you've got a table of people in your MySQL database: create table person ( person_id int, name text ) select * from person; +-------------------------------+ | person_id | name | +-------------------------------+ | 1 | Alice | ...

Any easy way to delete a user (having many to many relation with role) in acegi, grails?

Hi, In default acegi setting, person and authority have many to many relations. Thus, in addtion to people and authorities, there is a table authotiries-people. To delete a person (a user) I have to delete the related record in authotiries-people first....then come back to delete the record... the problem is: other people are still u...

Order in many to many relation in Django model

I am writing a small website to store the papers I have written. The relation papers<-> author is important, but the order of the name of the authors (which one is First Author, which one is second order, and so on) is also important. I am just learning Django so I don't know much. In any case so far I have done: from django.db import ...

How to customize a many-to-many inline model in django admin

I'm using the admin interface to view invoices and products. To make things easy, I've set the products as inline to invoices, so I will see the related products in the invoice's form. As you can see I'm using a many-to-many relationship. In models.py: class Product(models.Model): name = models.TextField() price = models.Deci...

Formatting inline many-to-many related models presented in django admin

I've got two django models (simplified): class Product(models.Model): name = models.TextField() price = models.IntegerField() class Invoice(models.Model): company = models.TextField() customer = models.TextField() products = models.ManyToManyField(Product) I would like to see the relevant products as a nice tabl...

Core Data breaking many-to-many relationship

Hi, I have the following data model and i want to break the many-to-many relationship between EntityA and EntityB. I'm doing this by removing EntityC object that connects both of them. I found that EntityA still have a relationship with EntityB although I saved the managed object context, I can see the changes take affect after EntityA r...

Managing Many to Many relationships in asp.net Wizard Control

Say I have this entity with a lot of attributes. In the input form I have decided to implement a wizard control so I can collect information about this entity in several steps. The problem is that I need to collect information that has been modeled has many to many relationships. I am planning to use a telerik gridview to manage this (...

fluentnhibernate ManyToMany does not add records to the junction table

When saving my many-to-many related entities, the entities are saved ok. However the junction table stays empty: Mapping on Product side (ProductMap.cs) HasManyToMany(x => x.Pictures) .Table("Product_Picture") .ParentKeyColumn("Product") .ChildKeyColumn("Picture") .Cascade.All() .Inverse() This produces the following xml: <bag cas...

How to insert rows in a many-to-many relationship

Hello, I am having an issue trying to save into an intermediate table. I am new on Rails and I have spent a couple of hours on this but can't make it work, maybe I am doing wrong the whole thing. Any help will be appreciated. =) The app is a simple book store, where a logged-in user picks books and then create an order. This error is ...

Insert record in Linq to Sql

Is this the easiest way to insert a record with Linq to Sql when there's a many-to-many relationship, or is there a better/cleaner way? I wasn't sure why things weren't working at first, but when I added a second SubmitChanges() it worked. Why was this necessary? Would be grateful if someone could clarify this a bit! private void Insert...

[Rails3] How to do multiple many to many relationships between the same two tables.

Hi. I have a model of a club where I want to model the two entities Meeting and Member. There are actually two many-to-many relationships between these entities though, as for any meeting a Member can either be a Speaker or a Guest. Now I am an OO thinker, so would normally just create the two classes and each one would just have two a...

How to constrain a table linking two tables in many-to-many relationship

Say I have the following tables and columns: comp: id, model dvd: id, model comp2dvd: id, id_comp, id_dvd A computer can have multiple dvd drives, even of the same model, and a dvd drive can appear in multiple computers. How do I make it so that comp2dvd table can have only existing comp and dvd id...

How to use Many to Many in Rails?

Hello! In my project, I have users and quests. One User can join multiple quests and one quest can have multiple users. So I created a table called questing, containing the user_id and the quest_id. In my user.rb I did following: require 'digest/sha1' class User < ActiveRecord::Base has_many :questings has_many :quests ,:through =>...

Understanding many to many relationships and Entity Framework

I'm trying to understand the Entity Framework, and I have a table "Users" and a table "Pages". These are related in a many-to-many relationship with a junction table "UserPages". First of all I'd like to know if I'm designing this relationship correctly using many-to-many: One user can visit multiple pages, and each page can be visited b...

Entity Framework 4 & WCF Data Service: N:M mapping

I have three tables in my database: An A table, a B table, and a many-to-many ABMapping table. For simplicity, A and B are keyed with identity columns; ABMapping has just two columns: AId and BId. I built an Entity Framework 4 model from this, and it did correctly identify the N:M mapping between A and B. I then built a WCF Data Service...

SQL: many-to-many relationship, IN condition

I have a table called transactions with a many-to-many relationship to items through the items_transactions table. I want to do something like this: SELECT "transactions".* FROM "transactions" INNER JOIN "items_transactions" ON "items_transactions".transaction_id = "transactions".id INNER JOIN "items" ON "items"....

Filtering second level of Many-to-Many relations in Django

Consider three django models: AA, BB and CC. AA has an M2M reference to BB and BB has an M2M reference to CC. I have a single instance of AA. How do I execute a filter() QuerySet over the set of CC instances that are M2M related the the BB instances that are M2M related to that single AA instance? ...

ORM on android SQLite and database scheme

I'm looking for a very simple ORM framework working on Android for sqlite. I've been testing activeAndroid but none of the example could ever build on Eclipse. By the way, how do guys implements a "many to many" relationship in sqlite for android ? How do you reflect the cascade regarding deletion of rows and guarantee the database integ...

How to Query Many to Many Objects in NHibernate

Hi, I have two database tables that have a many to many relationship: People and Organization. And of course there is a table that connects these two called OrganizationPeople. In NHibernate mapping, they each have a Bag of the other. In People's mapping, the Bag is mapped like this: <bag name="Organizations" table="OrganizationPeop...