0

I have the following table:

create table scheduled_tasks (
  task_name varchar(100),
  task_instance varchar(100),
  .
  .
  .
  last_success DATETIME,
  last_failure DATETIME,
  last_heartbeat DATETIME,
  version numeric(19,0),
  PRIMARY KEY (task_name, task_instance)
);

As you can see the primary key is two strings, they also can be anything so there is no way to create a valid reference table to embed into the the model. Is there any other way to define this composite key in JPA?

Collin Barrett
  • 2,441
  • 5
  • 32
  • 53
JBMac
  • 329
  • 1
  • 6
  • 18
  • Possible duplicate of https://stackoverflow.com/questions/13032948/how-to-create-and-handle-composite-primary-key-in-jpa – Sazzadur Rahaman Jul 18 '18 at 01:35
  • Possible duplicate of [How to create and handle composite primary key in JPA](https://stackoverflow.com/questions/13032948/how-to-create-and-handle-composite-primary-key-in-jpa) – Sazzadur Rahaman Jul 18 '18 at 01:36
  • why not read some JPA docs first? http://www.datanucleus.org:15080/products/accessplatform_5_1/jpa/mapping.html#application_identity –  Jul 18 '18 at 05:58

0 Answers0