Join conditions on entity relation
See original GitHub issueIs it possible to define a custom join condition for an entity relation? Some pseudo code to illustrate the intent.
type Position = 'pg' | 'sg' | 'sf' | 'pf' | 'c';
class Player {
id: number;
name: string;
position: Position;
teamId: number
@ManyToOne(type => Team, team => team.players)
team: Team;
}
class Team {
id: number;
@OneToMany(type => Player, player => player.team)
@JoinCondition('team.players','shootingGuards','players.teamId = team.id and players.position = "sg"')
shootingGuards: Player[]
}
I know this is possible through the querybuilder, but looking at the docs there does not seem to be a way to define something like this on the entities itself
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:6 (1 by maintainers)
Top Results From Across the Web
JOIN Relationships and JOINing Tables - The Data School
A JOIN SQL statement combines two data from two tables together. In this interactive SQL tutorial, learn the most common JOIN statements.
Read more >Concepts → Join Condition
A join condition defines the relationship between a physical schema entity object and itself (self-join) or the relationship between two entity objects: a ......
Read more >How to specify several join conditions for 1:1 relationship in ...
Have you tried to specify second join column with columnDefinition="enum('YOUR_CONSTANT')") ? · You can use queryBuilder when making the query ?
Read more >Configuring how Relationship Joins
Specifying Alternate Join Conditions¶ ... The default behavior of relationship() when constructing a join is that it equates the value of primary key...
Read more >Join Query In Entity Framework - TekTutorialsHub
The next two arguments specify the condition on which you want to join the tables. The first object is from the outer table...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is a feature I would really like to see. Any updates on if it’s planned for implementation?
+1 Leaving my use case here: