composite-primary-key Questions

10

I was working on an Access database which loved auto-numbered identifiers. Every table used them except one, which used a key made up of the first name, last name and birthdate of a person. Anyways...

3

Solved

I have a problem with Hibernate @EmbeddedId. @Embeddable public class EnrolRegEmbededId implements Serializable { @Column(name="ENROL_NO") private String enrolNo; @Column(name="REG_...
Boutte asked 31/8, 2018 at 7:43

3

Solved

I'm having trouble with the ordering of the columns in my composite primary key. I have a table that contains the following: @Embeddable public class MessageInfo implements Serializable { privat...
Militant asked 15/11, 2011 at 16:13

3

Solved

How to provide primary key for multiple column in a single table using PostgreSQL? Example: Create table "Test" ( "SlNo" int not null primary key, "EmpID" int not null, /* Want to become prim...

9

Solved

I have in my DataBase a table with two primary keys (id and language_id) and I need put it in my models. The default primaryKey in Models (Model.php in Laravel 5) is id, and I want that the primary...
Nonreturnable asked 14/7, 2015 at 19:5

4

Solved

I have to work with hibernate and not very sure how solve this problem, I've 2 table with a 1..n relationship like this: ------- TABLE_A ------- first_id (pk) second_id (pk) [other fields] ----...
Hypodermic asked 22/8, 2011 at 11:18

5

Solved

I get the following exception while inserting an object with hibernate. Reading from the database works like a charm. I use MySQL 5.5 as database provider and hibernate 3.6.5. I have the following...
Charactery asked 19/7, 2011 at 8:44

2

Solved

I'm using Asp.Net Core 2.1, Mvc, c#, EF Core with Code First and Migrations. I'm trying to build a table that has a composite primary key in the Migration.Up() method: migrationBuilder.CreateTa...

8

Solved

I would like to see an example of: When this is appropriate When this is not appropriate Is there a time when the choice of database would make a difference to the above examples?
Amidase asked 5/2, 2010 at 0:58

3

Solved

I am using Room persistent library. I have requirement to add two primary keys in one table and one of the primary key should be auto increment. I don't know exact syntax to achieve this. Below is ...

3

Solved

I use spring data rest for crud. But when the entity has composite primary keys, I dont know how to to get an entity by giving the primary key. River class: @Entity public class River { private ...
Polygamous asked 3/5, 2017 at 14:42

2

Solved

In an ERD, a weak/non-identifying relationship is one that connects two strong entities, and is indicated with a dashed line. A strong/identifying relationship is one that connects a strong entity ...

3

I have two tables Table1( FileID, BundledFileID, Domain) and Table2( FileID, FileType, FileName) In Table2 FileID and FileType are the composite primary key. I want to create a foreig...

6

Solved

I have a table that is missing a column in its primary key constraint. Instead of editing it through SQL Server, I want to put this in a script to add it as part of our update scripts. What syntax ...
Armandinaarmando asked 6/1, 2012 at 17:6

0

Let's say I have the following database schema: class A(Base): __tablename__ = "a_table" id = Column(Integer, primary_key=True, autoincrement=True) version = Column(Integer, primary_k...

3

my question is an extension of this question (also mine :) ) -> Room composite Primary Key link to Foreign Key So, if I have this class: public class FoodWithIngredients extends Food{ @Relation(...
Shuttle asked 15/5, 2018 at 12:52

3

Solved

The EmbeddedId or IdClass annotation is used to denote a composite primary key. How can i use composite primary key without ( EmbeddedId or IdClass ) ? If it is possible to use composite primary k...
Silent asked 11/6, 2013 at 11:28

3

Solved

Let's say I have the following model: class Molecule(Base): db = Column(Integer, primary_key=True) id = Column(Integer, primary_key=True) data = Column(Integer) class Atom(Base): id = Column(...
Middlebreaker asked 6/3, 2013 at 17:58

2

Solved

I spent hours and hours searching for this one, and just by trial and error was I able to finally find the solution. Logging this in Stack Overflow for future searchers. Q: How do I create a comp...
Takeoff asked 22/11, 2015 at 7:10

4

Solved

How can I define a composite primary key consisting of two fields in SQL? I want to make a table name voting with fields QuestionID, MemberID, and vote. And the Composite primary key consists of th...
Ulrikaumeko asked 10/7, 2009 at 15:44

3

I have the following table defined in Cassandra 2.0.9: CREATE TABLE history ( histid uuid, ddate text, -- Day Date, i.e. 2014-11-20 valtime timestamp, -- value time val text, --value PRIMARY ...
Brigettebrigg asked 27/1, 2015 at 15:45

3

Solved

I have 2 tables. 1 called events with an event ID and another table called tickets which I want to have primary keys of event ID and ticket ID. I am also using a PostgreSQL database. At the moment ...
Jacques asked 3/3, 2019 at 11:19

1

Solved

I have a table with a composite primary keys including it's own and a FK from other table. I decided not to use an @IdClass nor @EmbeddedId. class SomeEntity { @Id private String someId; @Id...
Minoru asked 19/6, 2020 at 8:54

2

Solved

Say I have a class that looks like this: public class MyClass { @Id @Column(name = "ID") private long Id; } I can use a hibernate session to do a get or load on the class like this: MyClass ...
Organogenesis asked 28/4, 2015 at 17:11

3

Situation I have an Entity with a DiscriminatorColumn, configured for single table inheritance: @Entity @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="TYPE&quot...
Qualification asked 15/6, 2012 at 11:17

© 2022 - 2025 — McMap. All rights reserved.