Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda