S
S
Sland Show2018-09-12 00:36:53
Java
Sland Show, 2018-09-12 00:36:53

How can I create an entity without a primary key?

I have a table

CREATE TABLE IF NOT EXISTS user_role (
  user_id INT NULL ,
  role_id INT NULL ,
  CONSTRAINT user_role_user_id_fk
  FOREIGN KEY (user_id) REFERENCES user (id),
  CONSTRAINT user_role_role_id_fk
  FOREIGN KEY (role_id) REFERENCES role (id)
)
  ENGINE=InnoDB;

CREATE INDEX user_role_role_id_fk ON user_role (role_id);

CREATE INDEX user_role_user_id_fk ON user_role (user_id);


How can I create an entity for this table without a primary key ID?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
al_gon, 2018-09-12
@SlandShow

Something like here id-class-with-many-to-one-relation
PS: Please note that you have many-to-many

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question