Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Primary Key other than Id in Jhipster Entity

Tags:

jhipster

I want to create two entities.

Departments(Department Id,Department Name) and Employees(Employee Id, Employee Name, Address).

I want these primary keys for the tables:

Department Id for Departments, Employee Id for Employees.

And Jhipster creates two tables as: Departments(Id, Department Id, Department Name) and Empployee(Id, Employee Id, Employee Name, Address)

and it takes Id as a primary key in both of these tables.

In my Database Design I want Department Id and Employee Id as a primary key. So what to do next?

like image 635
parth makadia Avatar asked Jan 03 '23 10:01

parth makadia


1 Answers

Support for custom ids was added in the new JHipster Release v7.0.0.

In JDL you can write:

entity Foo {
  @Id customId Long
}

or

entity Foo {
  id UUID
}

see https://github.com/jhipster/generator-jhipster/pull/13258

like image 69
Sven Avatar answered Mar 11 '23 15:03

Sven