Questions tagged [one-to-one]

Refers to the quantity of an entity as a relationship to another entity. Meaning that for every instance of an entity, there is a single related instance of another entity.

Refers to the quantity of an entity as a relationship to another entity.

Meaning that for every instance of an entity, there is a single related instance of another entity.

1496 questions
0
votes
1 answer

Should a 1-to-1 table relationship be employed here?

I have the following columns for a simple request/action process between two users: request_type request_to request_by request_msg request_time and action_type action_by action_msg action_time The top reply from When we need to use 1-to-1…
0
votes
1 answer

Delete and insert with same primary key in place of update

I have a simple One-to-One relationship between table TICKETINFO and TICKETINFO_REMARK. TICKETINFO TICKETINFOID pk, REMARK varchar(128), TICKETDATE timestamp and TICKETINFO_REMARK TICKETINFOID fk, REMARK varchar(128) and TICKETINFOID will be…
saptarshi
  • 97
  • 1
  • 14
0
votes
1 answer

Hibernate OneToOne Mapping Issue

i have three entities as below: Property Property_Document Property_User Property and Property_Document have a One to Many relationship. Property and Property_User has One to One relationship. At the database level, Property_User has foreign key…
Ankur Raiyani
  • 1,509
  • 5
  • 21
  • 49
0
votes
1 answer

creating strict 1 to 1 relationship by code first

I want to create a 1 to 1 relationship by code first, below is my code, class Person { public int id { get; set; } public string Name { get; set; } public virtual PersonDetail detail { get; set; } } class PersonDetail { public int…
James
  • 2,570
  • 7
  • 34
  • 57
0
votes
1 answer

DataMapper has_one problem

I`m having trouble associating models in DataMapper. Its really simple, but i just can get the idea. So, i have 2 tables: 1. Books -> id -> title -> publisher_id 2. Publishers -> id -> title The classes: class Book property :id, Serial …
Joe
0
votes
2 answers

@OneToOne replacing entities

I have @OneToOne bidirectional relationship where parent (P) class has: @OneToOne(optional = true, mappedBy = "owner", orphanRemoval = true) @Cascade({org.hibernate.annotations.CascadeType.ALL}) on getter and child class (C) has on…
viliam
  • 503
  • 6
  • 23
0
votes
2 answers

How to design one business model to multiple tables?

What is the best practice to design one business model into a multiple tables using one to one relationship? Lets say I Have the following diagram; Both tables are representing ONE business object/entity which is the Person. For table…
Ahmed Magdy
  • 5,956
  • 8
  • 43
  • 75
0
votes
1 answer

NHibernate one-to-one: null id generated for AccountDetail

I got an exception "null id generated for AccountDetail" when mapping one-to-one relationship by using many-to-one with unique constraint. Here's my SQL tables: Account(Id, Name) AccountDetail(AccountId, Remark) AccountId is both primary and…
Mouhong Lin
  • 4,402
  • 4
  • 33
  • 48
0
votes
4 answers

How to create 1 to 1(or zero) relationship in SQL Server 2008

I know how to create one to one relationship only problem is that it demands rows in both tables e.g. i have a table emp_table => key1, key2, name, description emp_address_table => key1, key2, address system do not put mandatory constraints on…
Mubashar
  • 12,300
  • 11
  • 66
  • 95
0
votes
1 answer

Cascadable one-to-one, required:required relationship with EF

I have a Video class and a MediaContent class that are linked by a 1-1, required:required relationship: each Video must have exactly 1 associated MediaContent. Deleting a MediaContent object must result in the deletion of the associated Video…
guidupuy
  • 505
  • 3
  • 15
0
votes
2 answers

@AdditionalCriteria in combination with @OneToOne gives QueryException

I'm trying to create a RESTful service. For multi tenancy I'm applying the @AdditionalCriteria annotation. However, when I join an entity using the @OneToOne annotation the following Exception is raised: Exception [EclipseLink-6174] (Eclipse…
0
votes
2 answers

Ruby on Rails - Association issue :(

I'm a newbie and have searched many posts and railscast tutorials and still cant get around this associations thing. I have 2 models, a Hotel (created by scaffolding) and Facility. The point is to associate a facility to a hotel, but since my…
Silver
  • 693
  • 1
  • 10
  • 27
0
votes
1 answer

MySQL - When to have one to one relationships

When should one use one to one relationships? When should you add new fields and when should you separate them into a new table? It seems to me that you'd use it whenever you're grouping fields and/or that group tends to be optional. Yes? I'm trying…
RS7
  • 2,341
  • 8
  • 34
  • 57
-1
votes
3 answers

How do I join on the correct one-to-one table (super-type, sub-type model)?

I've been looking into first, second, and third normal forms, and I want to do a better job normalizing my tables. Part of this, I realized, was that I've never understood the purpose of one-to-one tables. From what I understand, "optional" data…
landons
  • 9,502
  • 3
  • 33
  • 46
-1
votes
1 answer

Can there be two one-to-one relationships between the same tables?

Can there be two one-to-one relationships between the same tables? And is it actually a "right" way to represent this? The task for such entities in the publication office database is following: Each order is assigned a unique number, customer id,…