The alternative atm is to directly query against the owning entity or
directly against the element. Granted that last one assumes that the
element defines a mapped reference back to the owner to be able to apply
the restriction based on the FK, but that's the more normal mapping anyway.
So e.g., if you have a filter like: `session.createFilter(
customer.getOrders(), "orderDate < currentDate() - {3 months}" )`, instead
you'd do: `select elements( c.orders ) from Customer c join c.orders where
c.id = :customerId and o.orderDate < currentDate() - {3 months}` or `select
o from Order o where o.customer = :customerId and o.orderDate <
currentDate() - {3 months}`.
Ultimately I'd also like to see "stream queries". This would take 2 forms:
1. Session#stream( Order.class )...
2. customer.getOrders().stream()... (this works because
customer.getOrders() is a PersistentCollection and we'd control the
stream() impl)
The reasons for removing it are:
1. It dirties the HQL grammar. A valid filter string is literally""
(empty String) which means that the grammar needs to allow for that.
2. IMO it is a clunky API
3. I am pretty sure noone uses it. Not to pick on Christian, but he is
a pretty advanced user and even he did not understand its use which speaks
both to its obscurity as well as its clunkiness.
On Mon, Jan 2, 2017 at 7:08 AM Gunnar Morling <gunnar(a)hibernate.org> wrote:
> I plan on removing Session#createFilter. There are numerous
reasons why
which I can discuss if anyone is interested in exploring this.
I'm curious, what are the reasons for removing it? And if we remove it,
what's the alternative for people to use?
2016-12-31 21:00 GMT+01:00 Steve Ebersole <steve(a)hibernate.org>:
As I have not been hearing hardly any feedback on these 6.0 design
questions I have been trying to start, I'll be doing something different in
this and any additional emails.. I'll state what I propose to do and if
anyone has issue with it they can make a counter proposal. Otherwise I
plan on following through with my proposal.
I plan on removing Session#createFilter. There are numerous reasons why
which I can discuss if anyone is interested in exploring this.
Ultimately I think it makes sense to handle this via Java 8 streams[1]
although I am not sure that needs to happen in 6.0
[1]
https://hibernate.atlassian.net/browse/HHH-10962
_______________________________________________
hibernate-dev mailing list
hibernate-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev