Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] [EL 2.3.0] QueryHints.REFRESH ignores CascadePolicy.NoCascading

Hello,

 

I noticed, that with EclipseLink 2.3.0 (or 2.2.0) the behavior of QueryHints.REFRESH has changed.

It seems, that not only the objects from the query will be refreshed now, but also all cascading references within that objects,

even if these objects haven’t been loaded yet.

 

In some cases, I don't want to refresh all references because that leads to a high performance loss.

I tried to use QueryHints.REFRESH_CASCADE (CascadePolicy.NoCascading) but this makes no difference.

It still refreshes every referenced object.

 

Example:

 

Query q = getEntityManager().createQuery("SELECT x FROM DeliveryAddress x");

q.setHint(QueryHints.REFRESH, "true");

q.setHint(QueryHints.REFRESH_CASCADE, CascadePolicy.NoCascading);

 

 

@Entity

@Table(name = "delivery_address")

public class DeliveryAddress  {

...

               @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)

                @JoinColumn(name = "lcation_id", unique = true, nullable = false)

                private Location location = null;

...

}

 

The query will refresh the "Location" entry too.

 

BTW, is there a kind of a specification for the QueryHints, that describes how a query has to behave when a hint is set?

 

Kind Regards, Michael


Back to the top