Skip to main content

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

Hi Michael,

If EclipseLink is refreshing objects that are not yet loaded, that is a bug. Please have a look at this bug. It may be related to your problem.

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

-Tom

Michael Simons wrote:
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


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

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


Back to the top