Skip to content

[Angular] Entity with String Id is not supported. #32434

@mshima

Description

@mshima
Overview of the issue

String Id is supported by backend but fails in angular application:

See the generated code:

  save(): void {
    this.isSaving.set(true);
    const stringIdTestEntity = this.stringIdTestEntityFormService.getStringIdTestEntity(this.editForm);
    if (stringIdTestEntity.label === null) {
      this.subscribeToSaveResponse(this.stringIdTestEntityService.create(stringIdTestEntity));
    } else {
      this.subscribeToSaveResponse(this.stringIdTestEntityService.update(stringIdTestEntity));
    }
  }

String Ids like User.login are required and should be passed by the user.
So the code above is wrong since stringIdTestEntity.label will never be null.

The most correct fix is to remove POST and always use PUT api for entities that doesn't have autoGenerated ids.

Related to #31891

JHipster info
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "baseName": "TestApp",
    "creationTimestamp": 1771959763976,
    "cypressAudit": true,
    "entities": [
      "StringIdTestEntity"
    ],
    "jhipsterVersion": "9.0.0-beta.3",
    "languages": [
      "en"
    ],
    "lastLiquibaseTimestamp": 1771959077000,
    "nativeLanguage": "en",
    "testFrameworks": [
      "cypress"
    ]
  }
}
Environment and Tools

openjdk version "25.0.1" 2025-10-21 LTS
OpenJDK Runtime Environment Temurin-25.0.1+8 (build 25.0.1+8-LTS)
OpenJDK 64-Bit Server VM Temurin-25.0.1+8 (build 25.0.1+8-LTS, mixed mode, sharing)

git version 2.30.1 (Apple Git-130)

node: v22.22.0
npm: 11.7.0

Docker version 29.2.1, build a5c7197

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
@ChangelogDate("20260224185117")
entity StringIdTestEntity {
  @Id label String
  @Required description String
}

search StringIdTestEntity with no

  • jhipster info output is mandatory for bug reports. This will allow us to use automated tests and generate the broken sample using jhipster from-issue command.
Motivation for or Use Case
Reproduce the error
Related issues
Suggest a Fix
JHipster Version(s)
Browsers and Operating System
  • Tickets opened without reproduction steps or that doesn't follows the template recommendation will be closed.
  • Checking this box is mandatory (this is just to show you read everything)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions