Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPA Derived Identifier doesn't work anymore with JDL #10739

Closed
1 task done
murdos opened this issue Nov 6, 2019 · 4 comments
Closed
1 task done

JPA Derived Identifier doesn't work anymore with JDL #10739

murdos opened this issue Nov 6, 2019 · 4 comments
Assignees
Milestone

Comments

@murdos
Copy link
Contributor

murdos commented Nov 6, 2019

Overview of the issue

OneToOne relationship with jpaDerivedIdentifier is generated as a standard (non jpaDerivedIdentifier) OneToOne relationship.

Reproduce the error

With the following JDL:

application {
    config {
        baseName mapsIdBug
        applicationType microservice
        databaseType sql
        prodDatabaseType postgresql 
    }
    entities *
}

entity A

entity B

relationship OneToOne {
  A to B with jpaDerivedIdentifier
}

Both A.java and B.java contains a generated Id:

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
    @SequenceGenerator(name = "sequenceGenerator")
    private Long id;
Related issues
Suggest a Fix

The issue comes from the generated entity json file:

{
    "name": "A",
    "fields": [],
    "relationships": [
        {
            "relationshipType": "one-to-one",
            "otherEntityName": "b",
            "otherEntityRelationshipName": "a",
            "relationshipName": "b",
            "otherEntityField": "id",
            "ownerSide": true,
            "options": {
                "useJPADerivedIdentifier": true
            }
        }
    ],
    "changelogDate": "20191106101718",
    "entityTableName": "a",
    "dto": "no",
    "pagination": "no",
    "service": "no",
    "jpaMetamodelFiltering": false,
    "fluentMethods": true,
    "readOnly": false,
    "clientRootFolder": "",
    "applications": [
        "mapsIdBug"
    ]
}

In previous versions (before jhipster/jhipster-core#349 I think), JSON would have been:

{
    "name": "A",
    "fields": [],
    "relationships": [
        {
            "relationshipType": "one-to-one",
            "otherEntityName": "b",
            "otherEntityRelationshipName": "a",
            "relationshipName": "b",
            "otherEntityField": "id",
            "ownerSide": true,
            "useJPADerivedIdentifier": true
        }
    ],
    "changelogDate": "20191106101718",
    "entityTableName": "a",
    "dto": "no",
    "pagination": "no",
    "service": "no",
    "jpaMetamodelFiltering": false,
    "fluentMethods": true,
    "readOnly": false,
    "clientRootFolder": "",
    "applications": [
        "mapsIdBug"
    ]
}
JHipster Version(s)

6.4.1

JHipster configuration
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)
@MathieuAA
Copy link
Member

This has been fixed and in the master branch

@MathieuAA
Copy link
Member

@MathieuAA MathieuAA self-assigned this Nov 6, 2019
@pascalgrimaud
Copy link
Member

@MathieuAA : is it fixed in current master ?

@MathieuAA
Copy link
Member

Now that the release has been done, yes

@pascalgrimaud pascalgrimaud added this to the 6.5.0 milestone Nov 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants