Skip to main content

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

Hi Tom,

The following might help determining the reason:
After I removed the line @JoinFetch(value=JoinFetchType.OUTER) for Tour.positions
the test was successful, the stops were refreshed correctly (see test2.log).
So it seems that when a JoinFetch is specified for a collection, EL refreshes the collection but "forgets" to refresh the members of it.

-Michael


-----Ursprüngliche Nachricht-----
Von: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] Im Auftrag von Tom Ware
Gesendet: Dienstag, 28. Dezember 2010 14:57
An: EclipseLink User Discussions
Cc: EclipseLink User Discussions
Betreff: Re: [eclipselink-users] cascade=refresh does not work like expected

Hi Michael,

  My mappings used the same annotations as in the example you provided - including the JoinFetch.

-Tom

On Dec 27, 2010, at 4:30 AM, Michael Simons <Michael.Simons@xxxxxxxxxxx> wrote:

> Hi Tom,
> 
> Is there also a combination with the @JoinFetch annotation in your test-case?
> 
> Kind Regards, Michael
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] Im Auftrag von Tom Ware
> Gesendet: Freitag, 24. Dezember 2010 17:10
> An: EclipseLink User Discussions
> Betreff: Re: [eclipselink-users] cascade=refresh does not work like expected
> 
> Hi Michael,
> 
>   I cannot reproduce the problem on the object model I have that has similar 
> mappings.  I see similar SQL, but the refresh itself works.  Can you provide 
> some code you can be run to see the issue?
> 
> -Tom
> 
> Michael Simons wrote:
>> Hi Tom,
>> 
>> the data in the application is not refreshed. That's the problem. I did the SQL examination just to find the reason.
>> 
>> Kind Regards, Michael
>> 
>> -----Ursprüngliche Nachricht-----
>> Von: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] Im Auftrag von Tom Ware
>> Gesendet: Donnerstag, 23. Dezember 2010 20:40
>> An: EclipseLink User Discussions
>> Betreff: 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
>> _______________________________________________
>> eclipselink-users mailing list
>> 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
> _______________________________________________
> eclipselink-users mailing list
> 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
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

Attachment: test2.log
Description: test2.log


Back to the top