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
When using base class' custom repository, the discriminator is ignored #2927
Comments
Closing because this hasn't had any response. |
This issue still occurs, so would be worth resolving it. |
When using a STI scheme and an EntityManager or Repository with base class target, the wrong discriminator was written to the database despite giving an concrete entity. This was because of the entity's target being ignored in favor of the target of the Repository or the EntityManager. fixes typeorm#2927
When using a STI scheme and an EntityManager or Repository with base class target, the wrong discriminator was written to the database despite giving an concrete entity. This was because of the entity's target being ignored in favor of the target of the Repository or the EntityManager. fixes typeorm#2927
When using a STI scheme and an EntityManager or Repository with base class target, the wrong discriminator was written to the database despite giving an concrete entity. This was because of the entity's target being ignored in favor of the target of the Repository or the EntityManager. fixes typeorm#2927
When using a STI scheme and an EntityManager or Repository with base class target, the wrong discriminator was written to the database despite giving an concrete entity. This was because of the entity's target being ignored in favor of the target of the Repository or the EntityManager. fixes typeorm#2927
When using a STI scheme and an EntityManager or Repository with base class target, the wrong discriminator was written to the database despite giving an concrete entity. This was because of the entity's target being ignored in favor of the target of the Repository or the EntityManager. fixes typeorm#2927
When using a STI scheme and an EntityManager or Repository with base class target, the wrong discriminator was written to the database despite giving an concrete entity. This was because of the entity's target being ignored in favor of the target of the Repository or the EntityManager. fixes #2927
Still an existing issue. |
Still an existing issue in v0.2.45 .. is this fixed in a later v3 version? |
@Distortedlogic Nope, still an issue in v0.3.9 |
@bombillazo seems it was supposed to be fixed in like v0.3.5 |
My bad! You are correct, I had fixed it, I was missing the discriminator type as the parameter of the decorator! Sorry for the confusion. 😖 |
Issue type:
[x ] question
[x ] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ]
cordova
[ ]
mongodb
[ ]
mssql
[ ]
mysql
/mariadb
[ ]
oracle
[x ]
postgres
[ ]
sqlite
[ ]
sqljs
[ ]
react-native
[ ]
expo
TypeORM version:
[x ]
latest
[ ]
@next
[ ]
0.x.x
(or put your version here)Steps to reproduce or a small repository showing the problem:
I have a Single Table Inheritance structure; User and its child classes. At some point I am saving an instance of User's child class created with the appropriate constructor;
So I receive a payload object and then match the role and choose the appropriate constructor so that it should be the right kind of entity, and then populate it and save.
However, when I run this code, I receive this error:
So I see that when it saves, it is somehow obtaining "User" as the discriminator value from the repository.
My solution has been to use the EntityManager to save the entity and it works as expected. So it's not like it's impossible to do what I want.
Additional info:
My User entity:
And the admin:
The text was updated successfully, but these errors were encountered: