Skip to content

The logic about manytomany relationship #29047

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

Open
3 tasks
medoer opened this issue Mar 25, 2025 · 2 comments
Open
3 tasks

The logic about manytomany relationship #29047

medoer opened this issue Mar 25, 2025 · 2 comments

Comments

@medoer
Copy link

medoer commented Mar 25, 2025

Overview of the issue

In a JHipster-generated application, there is an inconsistency in handling many-to-many relationships:

  • The owner entity's edit page correctly retrieves and updates associated data.
  • The other entity's edit page does not return associated records and does not allow modifications.
JHipster JDL Configuration
JDL Definitions
      entity Product {
        name String required,
        price BigDecimal required
      }
  entity Category {
    name String required
  }
  
  relationship ManyToMany {
    Product{categories} to Category{products}
  }
  
  paginate Product with pagination
  filter Product
  
  paginate Category with pagination
  filter Category
-->
  • JDL is mandatory for bug reports. This will allow us to use automated tests and generate the broken sample using the jhipster from-issue command.
Motivation for or Use Case

This issue prevents proper handling of many-to-many relationships in the generated UI, leading to incomplete data retrieval and modification restrictions.

Reproduce the Error
  1. Generate a JHipster application with a many-to-many relationship.
  2. Go to the edit page of the owner entity and verify that associated data is retrieved correctly.
  3. Go to the edit page of the other entity and observe that no related data is fetched or editable.
Related Issues
Suggest a Fix
JHipster Version(s)

8.9.0

Browsers and Operating System
  • Tickets opened without reproduction steps or that do not follow the template recommendation will be closed.
  • Checking this box is mandatory (this is just to show you read everything).
@mshima
Copy link
Member

mshima commented Mar 25, 2025

Please provide a full jdl with application in the issue description.

@medoer
Copy link
Author

medoer commented Mar 26, 2025

Just a example, this is all
`entity Category {
name String required
}

relationship ManyToMany {
Product{categories} to Category{products}
}

paginate Product with pagination
filter Product

paginate Category with pagination
filter Category`

The yo-rc.json

{ "generator-jhipster": { "applicationType": "monolith", "authenticationType": "jwt", "baseName": "y", "buildTool": "maven", "cacheProvider": "no", "clientFramework": "react", "clientTestFrameworks": [], "clientTheme": "litera", "clientThemeVariant": "primary", "creationTimestamp": 1742870855728, "databaseType": "sql", "devDatabaseType": "h2Memory", "enableHibernateCache": null, "enableTranslation": true, "entities": ["Product", "Category"], "feignClient": null, "jhipsterVersion": "8.9.0", "jwtSecretKey": "ODE5NTEwYjBiYzBjNzk0NDkwYzhhMWE1Y2E2YWU3OWJlOWZiOWYyMTY4YTlkZTAzODJjYjRjYTc1MTZkZmNmODQxZGRjZmMwMTRjZDBhZTY2MWY4YjE3NzhkZjRiZmUxNDBlY2U5ODMzMjM1NjZiNDU5OTQzNDk2OGE4Mjc4MTQ=", "languages": ["en"], "lastLiquibaseTimestamp": 1742871182000, "microfrontend": null, "microfrontends": [], "nativeLanguage": "en", "packageName": "com.mycompany.myapp", "prodDatabaseType": "mysql", "reactive": false, "serverPort": null, "serviceDiscoveryType": null, "syncUserWithIdp": null, "testFrameworks": [], "withAdminUi": true } }

Image Image Image

@mshima

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

2 participants