-
-
Notifications
You must be signed in to change notification settings - Fork 611
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
I think it would be useful to be able to add filters to the join conditions.
Describe the solution you'd like
@Entity()
export class Post {
@OneToMany(() => Comment, comment => comment.post)
@Filter({ name: "enabledComments", cond: { enabledComments: true } })
@FilterJoinTable({ name: "notDeletedComments", cond: { isDeleted: false } })
comments = new Collection<Comment>(this);
}const posts = await orm.em.find(Post, { title: "Example" }, {
populate: ["comments"]
});It should generate a query like this:
select * from "Post" as p
join "Comment" as c on (p.id = c."postId")
and (p."enabledComments" = true)
and (c."isDeleted" = false);See Hibernate docs (Example 19.2. Using @FilterJoinTable for filterting on the association table)
Describe alternatives you've considered
I've read about filters and LoadStrategy.SELECT_IN, but I think LoadStrategy.SELECT_IN is bad for performance
hayksaryan and bartvanremortele
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request