Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Potential Bug in 2.1.1: values are written to wrong attributes

Hi Michael,

If you have a scenario where joining a table twice results in incorrect data. That is likely a bug. We have test cases that access the same table multiple times, so hopefully when you file the bug, you can give us a way of recreating what you are seeing so we can isolate the problem.

-Tom

Michael Simons wrote:
Hi Chris, Tom,

There seems to be a problem, when you ask EL to join a table twice, within the JPQL-Query as well as by a hint.

Now that I removed the join-clause in the JPQL-Query, it works.

Is this a known behavior or do I still need to file a bug?

Kind Regards, Michael

*Von:* eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] *Im Auftrag von *Christopher Delahunt
*Gesendet:* Freitag, 26. November 2010 14:37
*An:* EclipseLink User Discussions
*Cc:* Elke Hopp
*Betreff:* Re: [eclipselink-users] Potential Bug in 2.1.1: values are written to wrong attributes

Hello Micheal,

What is the complicated query, and what is the SQL that gets generated in the simple and complicated cases? I don't see any settings that might cause this, so you may want to file a bug with a test case so someone can step through it.

Best Regards,
Chris

On 26/11/2010 8:23 AM, Michael Simons wrote:

Hello Tom,

I tried just Location with Location.address and Location.proposedAddress. The result is ok, i.e., there's no wrong mapping.

So my guess was wrong, it must be caused by the complicated query.

Is the given information enough for you to start any investigation, or do you need more information?

Kind Regards, Michael

-----Ursprüngliche Nachricht-----

Von: eclipselink-users-bounces@xxxxxxxxxxx <mailto:eclipselink-users-bounces@xxxxxxxxxxx> [mailto:eclipselink-users-bounces@xxxxxxxxxxx] Im Auftrag von Michael Simons

Gesendet: Freitag, 26. November 2010 11:32

An: EclipseLink User Discussions

Cc: Elke Hopp

Betreff: Re: [eclipselink-users] Potential Bug in 2.1.1: values are written to wrong attributes

Hi Tom,

sorry for the delay - I had problems with my mailer.

The two classes and the persistence xml are attached.

Here's the code snippet that we're using. In the comment you see the clause that EL does not handle correctly:

        /**

         * Retrieve unplanned orders.

         * @param root -

         */

        private void retrieveOrders (ISentinel root) {

               OrderManager omgr = managerFactory.getOrderManager(em, parent);

               TypedQuery<CustomerOrder> query = omgr.createCustomerOrderQuery (false, false, null, false, null);

               query.setHint(QueryHints.LEFT_FETCH, "o.schedule");

               query.setHint(QueryHints.LEFT_FETCH, "o.schedule.entries");

               query.setHint(QueryHints.FETCH, "o.deliveryAddress");

               query.setHint(QueryHints.FETCH, "o.deliveryAddress.location");

               query.setHint(QueryHints.FETCH, "o.deliveryAddress.customer");

               query.setHint(QueryHints.FETCH, "o.deliveryAddress.location.address");

               // When we set the following hint, the attributes of address are not mapped correctly anymore.

               //             query.setHint(QueryHints.LEFT_FETCH, "o.deliveryAddress.location.proposedAddress");

               query.setHint(QueryHints.LEFT_FETCH, "o.claim");

               query.setHint(QueryHints.LEFT_FETCH, "o.positions");

               for (CustomerOrder order : query.getResultList ()) {

                       if (checkDomain(order) && (!parent.isOrdersInTime () || timefilter (order))) {

                               if(order.getDeliveryAddress() == null)

                                      em.refresh(order);

                               root.addOrder (order);

                       }

               }

        }

I'll try to reproduce the failure in a less complicated query, because I guess the problem is that Location references Address two times. But maybe you're already able to detect the problem.

Kind Regards, Michael

-----Ursprüngliche Nachricht-----

Von: Tom Ware [mailto:tom.ware@xxxxxxxxxx]

Gesendet: Freitag, 19. November 2010 17:17

An: EclipseLink User Discussions

Cc: Michael Simons; Elke Hopp

Betreff: Re: [eclipselink-users] Potential Bug in 2.1.1: values are written to wrong attributes

Michael,

   Can you please post all the information related to how these items are mapped?  (classes with annotations, relevant xml files)

   Also, can you please post the code snippet you are using to read the objects.

-Tom

Michael Simons wrote:

    Sorry for the mail without subject.

    So, once again:

    Hello,

    EclipseLink does not load correctly classes like the following:

    class Address {

    .

    }

    class Location {

      Private Address address;

      Private Address proposedAddress;

    .

    }

When instances of Location are queried from the database, the query is correct, but the values of some fields of Location.address are mapped
    into fields of Location.proposedAddress.

At the moment we are already discussing to replace EL because of this
    weird behavior.

    Can anyone help me with this urgent issue, please?

    Is this a known bug, already?

    Kind Regards,

    Michael Simons

    OPTITOOL GmbH

    Bruderwöhrdstrasse 15b

    93055 Regensburg

    www.optitool.de <http://www.optitool.de> <http://www.optitool.de>

    *Von:* Michael Simons

    *Gesendet:* Freitag, 19. November 2010 17:14

    *An:* 'eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>'

    *Cc:* Elke Hopp

    *Betreff:*

    Hello,

    EclipseLink does not correctly load classes like the following:

    class Address {

    .

    }

    class Location {

      Private Address address;

      Private Address proposedAddress;

    .

    }

When instances of Location are queried from the database, the query is correct, but the values of some fields of Location.address are mapped
    into fields of Location.proposedAddress.

At the moment we are already discussing to replace EL because of this
    weird behavior.

    Can anyone help me with this urgent issue, please?

    Is this a known bug, already?

    Kind Regards,

    Michael Simons

    OPTITOOL GmbH

    Bruderwöhrdstrasse 15b

    93055 Regensburg

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

    --

    _______________________________________________

    eclipselink-users mailing list

    eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>

    https://dev.eclipse.org/mailman/listinfo/eclipselink-users

_______________________________________________

eclipselink-users mailing list

eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>

https://dev.eclipse.org/mailman/listinfo/eclipselink-users


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

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


Back to the top