[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] cascade=refresh does not work like expected

Are you actually seeing that the data is not refreshed in your application, or are you just examining the SQL? (i.e. is the app not refreshing, or just not JOIN FETCHING on the refresh?)

-Tom

Michael Simons wrote:
Hello,



[EL 2.1.1]

We’ve got three classes Vehicle, Tour and TourPosition. A Vehicle has zero, one or more Tours. A Tour has one none, one or more TourPositions (the stops)



So we declared

Class Vehicle {

@OneToMany(cascade={CascadeType./MERGE/, CascadeType./REFRESH/, CascadeType./REMOVE/}, fetch=FetchType./LAZY/, mappedBy="leadTruck")

@JoinFetch(value=JoinFetchType./OUTER/) *// Never remove this, or you will regret it - believe me you will.*

*  private* List<Tour> tours = *new* ArrayList<Tour>(113);


}



Class Tour {

@OneToMany(cascade = CascadeType./ALL/, fetch = FetchType./LAZY/, mappedBy = "tour")

  @JoinFetch(value=JoinFetchType./OUTER/)

*private* List<TourPosition> positions = *new* ArrayList<TourPosition> (113);


}



When I call em.refresh (vehicle) I would have expected that the tours and their positions are also refreshed, but they are not. The only SQL-Statement that I get is:

SELECT DISTINCT t1.vehicle_id, t1.measure_id, t1.jdo_version, …, t0.tour_id, t0.filled_up, t0.tour_text, …

FROM vehicle t1

LEFT OUTER JOIN tour t0 ON (t0.vehicle_id = t1.vehicle_id)

WHERE (t1.vehicle_id = ?)



So, at least the TourPositions are _/not/_ refreshed.



Is this a known issue/feature/bug?

Do I miss anything?

If it’s a known bug, is it fixed in 2.1.2?



Kind Regards and happy christmas, Michael


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

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