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

remove every instanceOf on any @Entity object #2551

Open
julien-louis opened this issue Dec 17, 2024 · 0 comments
Open

remove every instanceOf on any @Entity object #2551

julien-louis opened this issue Dec 17, 2024 · 0 comments

Comments

@julien-louis
Copy link
Collaborator

julien-louis commented Dec 17, 2024

Instanceof doesn't always work with Hibernate proxies, but sometimes it does.

As a precaution I recommend to use getType() instead when it's implemented like in Datasets & DatasetAcquisition, or use Hibernate.getClass() which return the real class, proxy or not.

We should do that with every instanceof to any @entity in the code.

ie :
if (dataset instanceof MrDataset)
should be
if(DatasetType.Mr.equals(dataset.getType()))
or
Hibernate.getClass(ds).equals(MrDataset.class)

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

1 participant