Skip to content

findByAssociation has problems with auto generated coloumn by .hasOne method with mapsTo option. #817

@reumia

Description

@reumia
// Defining Model
LikesCut.hasOne('target', Cuts, {reverse: 'likes', field: 'targetId', mapsTo: 'target_id', required: true})

// CASE 1 : ER_BAD_FIELD_ERROR: Unknown column 't1.targetId' in 'on clause'
LikesCut.findByTarget({}).runAsync()
// CASE 2 : ER_BAD_FIELD_ERROR: Unknown column 't2.targetId' in 'on clause'
Cuts.findByLikes({}).runAsync()

it seems to tying join with wrong column name.
is there something wrong in my codes or isn't it prepared yet?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions