Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

153
Visualizações
TypeORM join maps to table.relation.id instead of table.relationId

I have somehow encountered a weird error, am joining alot of tables, a subset of the code as below:

...

.leftJoinAndSelect('req.steps', 'step')
.leftJoinAndSelect('step.user', 'appUser')
.leftJoinAndSelect('appUser.user', 'appStaff')

...

and the error I get is:

Unknown column 'appuser.user.id' in 'on clause'

and the table clearly has a userId column, so the strange part is all the other columns are trasnlated correctly, a subset of the generated query as below:

LEFT JOIN `step` `step` ON `step`.`requestId`=`req`.`id`  LEFT JOIN `step_user` `appUser` ON `appUser`.`id`=`step`.`userId`  LEFT JOIN `user` `appStaff` ON `appStaff`.`id`=appUser.user.id AND (`appStaff`.`deleted` IS NULL)

And a subsection of the entity:

  @ManyToOne(() => User, user => user.steps)
  user: User;

Basically, they are all defined the same but end up with different output, can someone explain to me what i did wrong here or if this is a known issue.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda