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 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>
> 
>  
> 
>  
> 
>  
> 
> *Von:* Michael Simons
> *Gesendet:* Freitag, 19. November 2010 17:14
> *An:* '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
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users

Attachment: persistence.xml
Description: persistence.xml

Attachment: Address.java
Description: Address.java

Attachment: Location.java
Description: Location.java


Back to the top