Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Eclipselink CascadeTypes Refresh

Thanks for the reply.

I forgot to mention, that if i change the FetchType.LAZY to Eager in the Part Class it works.

And yes if I set @cachable(false) at the Tolerance Entity it also works. I Know that, but these two “workarounds” are not possible because they slow down my  application enormously.

 

Regards steffen

 

 

Mit freundlichen Grüßen/Kind regards

Steffen Herter

Engineering Applications (FIDE1)

FC Eng. App. u Projektsysteme ZF-Konzern / FC Eng. App. u Projektsystems ZF Group

 

ZF Friedrichshafen AG

Finanzen, IT, M&A/Corporate Finance, IT, M&A
88038 Friedrichshafen, Deutschland/Germany
Telefon/Phone +49 7541 77-8801, Telefax/Fax +49 7541 77-908801

steffen.herter@xxxxxx

 

Vorsitzender des Aufsichtsrats/Chairman of the Supervisory Board: Prof. Dr. Giorgio Behr
Vorstand/Board of Management: Dr. Stefan Sommer (Vorsitzender/CEO), Dr. Konstantin Sauer, Jürgen Holeksa, Michael Hankel, Wilhelm Rehm, Rolf Lutz

Sitz/Headquarters: Friedrichshafen

Handelsregistereintrag Amtsgericht Ulm HRB 630206/Trade register of the municipal court of Ulm HRB 630206

 

 

Von: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] Im Auftrag von André Prata
Gesendet: Donnerstag, 10. April 2014 11:21
An: EclipseLink User Discussions
Betreff: Re: [eclipselink-users] Eclipselink CascadeTypes Refresh

 

I might be wrong, but I guess your problem is in the cache. Eclipselink is probably not triggering a new select in the database, but you can be sure of it by increasing the debugging level.

 

If it is indeed a caching problem, you should be able to solve it by disabling the cache on the Part entity:

 

If you want to be able to change your database from sources other than your JPA application you run into these kind of problems.


 

On Thu, Apr 10, 2014 at 10:15 AM, <steffen.herter@xxxxxx> wrote:

Hello,

 

i’ve a strange behavoir in my Application:

 

Eclipselink: 2.5.1

Javax-persisnence:2.0.1

WebApplication: JSF: 1.2

Caching: second Llevel cache activated

Weaving: static

 

Entities: Part, Tolerance

 

Class Part

@OneToMany(mappedBy = "part", targetEntity = Tolerance.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL)

@PrivateOwned

@BatchFetch(BatchFetchType.JOIN)

private List<Tolerance> tolerances = new ArrayList<Tolerance>();

 

Class Tolerance

@ManyToOne(optional = false,fetch=FetchType.LAZY)

@JoinColumn(name = "PD_ID", referencedColumnName = "PD_ID")

private Part part = null;

 

 

When I navigate to the part view of a single part the function loadPart(Part part) is called

 

       Part refreshedPart = partService.findById(part.getId());

       partService.refresh(refreshedPart)

 

for (Tolerance curTolerance : refreshedPart.getTolerances())

       {

             System.out.println(curTolerance.isManual());

       }

 

The refresh of a part is needed because other Applications can change the manual flag of the tolerance table directly in database.

 

What happens:

·         Let’s say getTolerances() delivers 3 tolerance objects and the isManual Flag of all 3 is false.

·         I change the flag of all 3 in database and set it to true. The I click the refreshPage Button and the Page is reloaded and the loadPart(Part part) is called again

·         I suggest that the refresh cascade type triggers a database select statement when refreshedPart.getTolerances()

·         I see that this select statement is called and the first sysout statement is correct and writes true to the console

·         Now we have 2 more loops to go. The next sysouts are false,false!?!?  à what I expected is that all 3 sysouts write true to the console

 

 

 

Does Anyone understand this behavior?

 

 

The following Workaround works:

Write  toleranceService.refresh(curTolerance); in the loop. But in my opinion that is exactlxy what the cascadyType should do.

 

 

 

Kind regards

Steffen

 

 


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

 


Back to the top