Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Conditional LEFT JOIN in JPQL

Hi Bernard, Vidas,

The best way to get this feature to the top of our implementation list is to vote for it. One of the main criteria we use when determining which features to implement next is the number of distinct votes.

I have updated the bug with some information about how to define a query that retrieves multiple items.

If you want to dynamically define a QueryKey, I believe it should work at the moment. You will have to use a small amount in internal API. Here is some pseudo code for the basic steps.

ServerSession session = (ServerSession)JpaHelper.getServerSession(myEntityManagerFactory)
  ClassDescriptor descriptor = session.getDescriptor(MyEntity.class);
  descriptor.addQueryKey(myQueryKey);
  myQueryKey.initialize(descriptor);

The changes that allow JPQL queries to use query keys will be in our 2.1 release. They appear in our nightly builds starting with last night's build.

-Tom

Vidas Timukas wrote:
Hi, Bernard,

Know nothing about EL API, but, according to Tom's example, might it be possible to define queryKey on the fly with User.getId() as ConstantExpression and destroy it after query execution. Maybe Tom can suggest something about this. Another question, which rises, how to retrieve both objects in result list, like List<Product, Favourite>, because ReadAllQuery(Product.class) from given example seems to return only list of Products. And last question for Tom: As you said, there is some work to support queryKeys in JPQL. Can you tell us, in which version of EL it will be supported:? For example:

SELECT p, f FROM Product p join p.favouritepk f


2010/5/11 <bht@xxxxxxxxxxxxx <mailto:bht@xxxxxxxxxxxxx>>

    Hello Vidas,

    I created a testcase and Tom responded to it:

    https://bugs.eclipse.org/bugs/show_bug.cgi?id=312146


    Can you believe that even with the current EclipseLink version, using
    the proprietary EclipseLink API, it is not possible to write a query
    with a conditional join where the condition comes from a parameter
    value?

    This is the simplest case I have been able to suggest. So no userId
    parameter for the query :(.

    It looks like I have to wait for some time (months?, a year?) before
    this is implemented, even before the spec is changed.

    Would you have any comment? Please vote for this.

    Best regards,

    Bernard

    _______________________________________________
    eclipselink-users mailing list
    eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
    https://dev.eclipse.org/mailman/listinfo/eclipselink-users




--
Sincerely,
Vidas


------------------------------------------------------------------------

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top