FilterDef on nested fields

Hello
It would be nice if, for FilterDef parameters, we could specify fields of nested objects.
For example:

@Entity
@FilterDef(name=“authorFilter”, parameters=@ParamDef(name=“author.name”, type=“string”))
public class Book {
@ManyToOne
private Author author;
}

@Entity
public class Author {
private String name;
}

1 Like

Another option is to “activate nested filter”

@Entity
public class Book {
@ManyToOne
private Author author;
}

@Entity
@FilterDef(name=“nameFilter”, parameters=@ParamDef(name=“name”, type=“string”))
public class Author {
private String name;
}

And when I can do this when requesting Book:

Session session = sessionFactory.openSession();
session.enableFilter("nameFilter").setParameter("name", "Mikl");
List<Book> books = session.createQuery("from Book").list();

Please join us on our chat platform and start a discussion about this feature request.

I started a new conversation. Thank you.