typeorm / typeorm

ORM for TypeScript and JavaScript. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.
http://typeorm.io
MIT License
34.14k stars 6.29k forks source link

cannot perform update query because update values are not defined. Call "qb.set(...)" method to specify updated values. #7092

Closed rubiin closed 2 years ago

rubiin commented 3 years ago

Issue Description

Expected Behavior

Typeorm should be able to save it

Actual Behavior

Throwing error message

                const userId: any = await transactionalEntityManager.save(Users, {
                    ...user,
                    display_id: user.employer_no,
                });

                await transactionalEntityManager.save(EmailLog, {
                    user: userId,
                    email: user.email,
                    token: tokenData,
                });
// include the output in code tags like these!

cannot perform update query because update values are not defined. Call "qb.set(...)" method to specify updated values.


### Steps to Reproduce

<!--
  Your bug will be investigated much faster if we can run your code and it doesn't
  have dependencies other than TypeORM. Issues without reproduction steps or
  code examples may be closed as not actionable.

  Please try to provide a Minimal, Complete, and Verifiable example.
  http://stackoverflow.com/help/mcve
-->

1. Query an entity with one to many relationship
2. save the query as the foreign key on another dependent entity

```typescript
// insert code here

My Environment

Dependency Version
Operating System
Node.js version 12.9.0
Typescript version v3.8,3
TypeORM version latest

Additional Context

Relevant Database Driver(s)

Are you willing to resolve this issue by submitting a Pull Request?

nebkat commented 3 years ago

Can you create a minimal reproducible sample repo where this behavior occurs?

rubiin commented 3 years ago

I tried with 0.2.28 and it works while this seems to be the issue with 0.2.29

rubiin commented 3 years ago

Can you create a minimal reproducible sample repo where this behavior occurs? I think this change is the cause of issue https://github.com/typeorm/typeorm/commit/b518fa15f9b2183545b3c0daa2447ecd38ecc859 @imnotjames @pleerock

nebkat commented 3 years ago

That is possible but it would help if you could make a test that reproduces the behavior, then we will easily find out exactly what is causing it and debug the problem (and prevent it from occurring in the future).

rubiin commented 3 years ago

Yeah I can , but it will take some time. As the project is private, I will have to setup a fresh one with reproduction of the issue but now do know for sure that the commit has something to do with this because its the only commit in the release which is changing the way querybuilder worked

rubiin commented 3 years ago

I will put a link to a repo tomorrow first hour

nebkat commented 3 years ago

No rush, it's just that anyone else trying to fix it will also have to do the same to reproduce. I don't think this particular commit would be responsible it is just for mapping property paths to the database names, but who knows. Could you post the full error log so we know where it is being thrown? There are two locations where it can happen.

rubiin commented 3 years ago

sure let me rerun it and i will post it in