Skip to content

relationship OneToOne is not Working as unidirectional #33264

Open

Description

@lkluge
Overview of the issue

I want create following Relation

relationship OneToOne {
Order{recipient} to Member
Order{publisher} to Member
}

to create following Class Contains

class Order {
private Member recipient;
private Member publisher;
-- more Attributes ---
}

For
class Member
not Relation to Order

if I execute my IDL creation

jhipster import-jdl jhipster-jdl.jh

I getting following Error Message

ERROR! An error occured while running jhipster:base-application:bootstrap#checkProperties
ERROR! ERROR! You have duplicate properties in entity Member: order
Error: You have duplicate properties in entity Member: order

On the Webpage

JHipster Domain Language (JDL) - Relationships

I think it must work

Unidirectional or bidirectional relationships?

Depending on how you design your models, you may want unidirectional relationships instead of bidirectional ones. This is achieved by not specifying an injected field like this:

relationship OneToOne {
A{a} to B
}

You can also not specify them, and at least one will be injected by default (the source)

relationship OneToOne {
A to B
}

If I use this relationship

OneToOne {
Order{recipient} to Member
}

I get following Error Message

ERROR! An error occured while running jhipster:base-application:bootstrap#checkProperties
ERROR! ERROR! You have duplicate properties in entity Order: recipient
Error: You have duplicate properties in entity Order: recipient
at BootstrapBaseApplicationGenerator.checkProperties (file:///opt/homebrew/lib/node_modules/generator-jhipster/dist/generators/base-application/generators/bootstrap/generator.js:413:31)

Motivation for or Use Case
JHipster Version(s)

jhipster --version
9.0.0

Browsers and Operating System

MacOS Version 26.4.1 (25E253)

Activity

  1. Gonare-22 commented on May 3, 2026

    @Gonare-22

    Hi, I’d like to work on this issue. I’m currently reproducing the problem locally and investigating the relationship generation flow.

  2. mshima commented on May 3, 2026

    @mshima
    Member

    See #25901.
    The linked PR won’t fix the issue. It will only workaround the current behavior. It generates tables which can change on incremental changes.

    The fix would involve using join tables instead of back reference relationship.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions