[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,

I tried to send an example that you can reconstruct:
otj-domain.jar: The model 
capture1.png: shows database after changing the stops of a tour
ELTestCase1.jar: Little test program to show my problem.
Testcase.log: output of the test program

The Procedure:
Starting Test1 that opens a TX and reads a Tour. Then waits for user confirmation.
While Test1 waits the Tour is changed, e.g. by removing stop #3, and committed.
In "capture1.png" you can see the tour after stop #3 was removed.

Now Test1 is continued. It refreshes the tour and prints it.
Please look at the sequence numbers of the stops. They differ from the database! Obviously the refresh did not cascade correctly.


Please let me know if there's anything missing.
-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: otj-domain-3.2.8.jar
Description: otj-domain-3.2.8.jar

Attachment: capture1.png
Description: capture1.png

Attachment: testcase.log
Description: testcase.log

Attachment: ELTestCase1.jar
Description: ELTestCase1.jar