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

Prevent cyclic dependency #3

Open
hohwille opened this issue Jun 22, 2018 · 2 comments
Open

Prevent cyclic dependency #3

hohwille opened this issue Jun 22, 2018 · 2 comments

Comments

@hohwille
Copy link
Member

The tutorial for building JumpTheQueue suggests build two entities that are both linking to each other:
https://github.com/oasp/oasp-tutorial-sources/wiki/OASP4jComponents#the-em-core-em-of-the-components

Such a cyclic relation is rather to be considered as an anti-pattern and is causing issues with JPA.
IMHO we should not propose such a design in our tutorial. Better decide which side is the "natural" side where to put the relation and if required to get it from the other side, create a query for that in DAO/repository.

@hohwille
Copy link
Member Author

Also references in a database are to be modeled as such using foreign key constraint.

idCode BIGINT

This will prevent referential integrity of the database. In very specific occasions that can be done on purpose (and should be commented/documented) so e.g. to be able to delete the referenced entity without updating references in linking entity.

@phschimm
Copy link
Member

phschimm commented Jan 6, 2020

Hi @hohwille,
I think the second issue has been addressed, since FK's are used here now.

I'm not sure however if the first issue was been addressed when the app was migrated from OASP to devonfw. The design documentation only shows a very simplified model of the application, which seems to indicate that there are no cyclic dependency anymore ...

Do you have any input on this?

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

No branches or pull requests

2 participants