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

Unidirectional one-to-one relationship always yields a bi-directional one #22887

Closed
jvence opened this issue Jul 17, 2023 · 1 comment · Fixed by #23011
Closed

Unidirectional one-to-one relationship always yields a bi-directional one #22887

jvence opened this issue Jul 17, 2023 · 1 comment · Fixed by #23011

Comments

@jvence
Copy link

jvence commented Jul 17, 2023

Using v8.0.0-beta.2 with app configured to use MongoDb

Overview of the issue

The following relationship definition always yields a bidirectional relationship meaning that both Board and City can access each other:

relationship OneToOne {
Board{city} to City
}

In generated City.java:
@DBREF
private Board board;

In generated Board.java:
@DBREF
@field("city")
private City city;

PLEASE NOTE that City.json does not have any reference to Board collection. See below

Motivation for or Use Case

No references to Board from City should be created as it would not be a unidirectional relationship

Reproduce the error

Create a jdl with two 2 entities Board and City and add the following relationship:
relationship OneToOne {
Board{city} to City
}

Related issues

No

Suggest a Fix
JHipster Version(s)

Using v8.0.0-beta.2

JHipster configuration
Entity configuration(s) entityName.json files generated in the .jhipster directory

Relevant code from Board.json:
"name": "Board",
"pagination": "pagination",
"relationships": [
{
"otherEntityName": "city",
"relationshipName": "city",
"relationshipSide": "left",
"relationshipType": "one-to-one"
},

Relevant code from City.json:
"name": "City",
"pagination": "pagination",
"relationships": [
{
"otherEntityName": "country",
"otherEntityRelationshipName": "city",
"relationshipName": "country",
"relationshipSide": "right",
"relationshipType": "many-to-one"
}
],

service * with serviceClass
paginate * with pagination

Browsers and Operating System

Safari

@jelharou
Copy link
Contributor

Same here. Not an issue in 7.9.3

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

Successfully merging a pull request may close this issue.

4 participants