one-to-many

nHibernate one-to-many inserts but doesnt update

Instead of getting into code, I have a simple question. Default behavior for a simple one-to-many is that it inserts the child record then updates the foreign key column with the parent key. Has anyone ever had a one-to-many where the child object gets inserted but not updated resulting in a row in my table with a null in the foreign k...

Entity Framework, Many To Many, Detached and Stub Entities

Hi guys I'm faced with my first real practical usage of a many-to-many relationship and am having a little bit of trouble with the approach... I'm using ASP.Net MVC and have the following 2 entities: Activity <---> Program. Now I was wondering what people think of the approach and if there is a better way of doing this: When pull o...

DataMapper has n with conditions

Hello, By any chance is it possible to create a conditional association with DataMapper? For example: I want the User have n Apps just if that user have the attribute :developer => true something like this: class User include DataMapper::Resource property :id, Serial property :name, String, :nullable => false property :scre...

JPA - Persisting a One to Many relationship

Hi, Maybe this is a stupid question but it's bugging me. I have a bi-directional one to many relationship of Employee to Vehicles. When I persist an Employee in the database for the first time (i.e. it has no assigned ID) I also want its associated Vehicles to be persisted. This works fine for me at the moment, except that my saved V...

Asp.net MVC-How to add order-orderDetails objects using EntityFramework?

I have an application that uses one-to-many relationshipped objects like oreder-orderDetails, vith EntityFramework. I want to use a view, that make it possible to add a new order with some orderDetails objects. I can create a strongly typed view, that returns an order object wich has a List orderDetails property, but can't populate the...

SQL query to find users that don't have any subscription to a specified list (many-to-many).

Having two tables, "users" and "lists", and a many-to-many "subscriptions" table relating users to lists (thus having foreign keys user_id and list_id), what would be a single SQL query to find all the users that don't have any subscription with a specific list_id (naturally including the users that have no subscriptions at all)? ...

Doctrine order by relation table with limit

I have two tables "series" and "programs" with programs being many to one one series. Series table id | name -------------- 1 | lorem 2 | ipsum 3 | foo 4 | bar Programs table id | name | series_id --------------------- 1 | program1 | 1 2 | program2 | 2 3 | program3 | 3 4 | program4 | 4 5 | program5 | 1 6 | progra...

NHibernate many-to-many assocations making both ends as a parent by using a relationship entity in the Domain Model

Entities: Team <-> TeamEmployee <-> Employee Requirements: A Team and an Employee can exist without its counterpart. In the Team-TeamEmployee relation the Team is responsible (parent) [using later a TeamRepository]. In the Employee-TeamEmployee relation the Employee is responsible (parent) [using later an EmployeeRepository]. Duplica...

SubSonic Simple Repository One-To-Many

Hi, I made a class like: public class Video { public Guid VideoID { get; set; } public VideoCategory VideoCategory { get; set; } public int SortIndex { get; set; } public string Title { get; set; } public string Body { get; set; } public string Author { get; set; } public string Filename { get; set; } p...

Can someone give me a mapping example of two NHibernate classes that have composite keys and one-to-many?

Can someone please give me an example of what the mappings would look like for two classes that both have composite keys and a one-to-many relationship? I have looked everywhere and tried 100 different things with no luck. E.g., HeaderTable -HCONO Decimal -HDVNO Decimal -HDTTK Decimal -HDES2 String -HDESC String -HDESC3 String HCO...

Django: How to define a model relationship to achieve the following?:

My app has clients that each have a single billing profile. I'm envisioning my app having a "Client" model with an attribute called "billing_profile" which would reference another model called "BillingProfile". Rather than define "BillingProfile" with a foreign key back to "Client" (ie, "client = models.ForeignKey(Client)"), I was think...

Django: ForeignKey with choices=Customer.objects.filter(account=self.account)

class Ticket(models.Model): """ An order placed by a customer. """ account = models.ForeignKey(Account) client = models.ForeignKey(Client, choices=Client.objects.filter(account=self.account)) Obviously this wouldn't work because there is no instance available for 'self',but you can see what I'm trying to do here. I ...

How do I unlink and remove a related object in CoreData

I have a core data entity which has an exclusive one to many relationship with another entity. This relationship is supposed to be a basic containment the first entity contains one or more of the second. An instance of the second entity can only be contained in one of the first entities. I want to be able to remove all the contained ent...

sql selection from one-to-many table

Hi, I have got 3 tables with those columns below: Topics: [TopicID] [TopicName] Messages: [MessageID] [MessageText] MessageTopicRelations [EntryID] [MessageID] [TopicID] messages can be about more than one topic. question is: given couple of topics, I need to get messages which are about ALL these topics and not the less, but t...

Django One-To-Many Models

The following models describe a vulnerability and the URLs out on the internet that reference that vulnerability. Assume that each URL only ever talks about 1 vulnerability, and that many URLs will discuss that vulnerability. Is this the correct way to lay out the model? class Vuln(models.Model): pub_date = models.DateTimeField("Publi...

Mapping many-to-many without a join table in Hibernate/NHibernate

I have two tables: CalendarEntry Id Date ... Holiday Id Date ... In my CalendarEntry class, I have a property like this public ISet<Holiday> Holidays { ... } which I want to associate to the Holiday instances that occur on the same Date as the CalendarEntry. However, I can't come up with how to do this. I've tried ma...

Hibernate One-to-Many cascade efficiency

I have been learning Hibernate for the past few weeks, I have gotten most of what I learned to work but have a question on the efficiency of a One-to-Many mapping. It works, but I am pretty sure that it could be tweaked quite a bit. When saving, I notice that there are three queries that get executed, an insert for the "Parent" object, a...

cocoa iphone core-data predicate one-to-many fetchrequest

I have a set of data where one of the attributes (Firmware) is a one-to-many relationship. If I want to get any records where the firmware id is 1 I can create a predicate using @"(ANY Firmware.FID==1)" Then I have another set of conditions that will refine the set even more using (TopLevel==YES) AND (Parent>0) How can I combine t...

How Do I Dynamically Manipulate Mulitiple Strings Returned by mysql_fetch_array from MySQL Tables with One to Many Relationships?

I am attempting to dynamically change portions of a record set string returned by a mysql_fetch_array function within a nested while loop. The results are pulled from MySQL tables with one to many relationships, so I sometimes get more than one string result per iteration through the while loop. The results returned are correct, but I a...

@OneToMany without inverse relationship and without a join table?

This is a similar problem to "Hibernate @OneToMany without a separate join table", in that I need a @OneToMany relationship without a join table. However, I would also like to not define the inverse relationship. Removing the inverse seems to result in a join table being automatically generated... is there a workaround for this? ...