I've doubt about this answer (it should be false false).
Since CheckingAccount is of type Account and c.evict(Account.class) will remove all account class and it's subtypes. So, c.evict(Account.class, 31) should remove CheckingAccount instance with PK 31.
Regards,
About Question enthuware.oce-jpad.v6.2.454 :
Moderator: admin
-
- Posts: 2
- Joined: Fri Feb 13, 2015 12:30 pm
- Contact:
-
- Site Admin
- Posts: 10113
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.454 :
You could be right, but the specification is not clear about it. That is what the explanation also says:
The Cache API documentation for evict(class), clearly mentions that all instances of the class *and its subclasses* are evicted. However, when you call evict(class, PK), the API does not mention anything about a subclass. Thus, it can be interpreted only the instance of the given class with the given primary key will be evicted.
If you like our products and services, please help us by posting your review here.
-
- Posts: 8
- Joined: Sun Jan 25, 2015 6:08 am
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.454 :
Although I agree with the vagueness of the API, I really hope that the real exam will not contain this kind of questions that can only be answered correctly when you know this kind of futile details by heart.
-
- Site Admin
- Posts: 10113
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.454 :
You might find a couple of such questions. We have included a few such questions in the question bank only to make you aware of this issue.
HTH,
Paul.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 15
- Joined: Fri Apr 10, 2015 12:53 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.454 :
Hi,
In EclipseLink v2.5.2 yields
In EclipseLink v2.5.2
Code: Select all
Cache c = emf.getCache();
Boolean flag1 = c.contains(Account.class, 31);
Boolean flag2 = c.contains(CheckingAccount.class, 31);
System.out.println(flag1 + " " + flag2);
c.evict(Account.class, 31);
flag1 = c.contains(Account.class, 31);
flag2 = c.contains(CheckingAccount.class, 31);
System.out.println(flag1 + " " + flag2);
BTW, the JavaDoc for Cache#contains(Class cls, Object primaryKey) also does not explicitly specify whether subclasses should be included. EclipseLink thinks they should, that's why even before calling evict it does *not* printtrue true
false false
Personally, I think the semantics of all these 3 methods w.r.t. subclasses was intended to be the same, because it's more convenient, and it's probably how most of the providers implemented it and also how the exam would expect us to answer.false true
-
- Posts: 358
- Joined: Fri Nov 29, 2013 8:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.454 :
With regard to how EclipseLink implements this Cache.evict() method, I cannot rely on any provider's implementation.
Some provider implements this without following the specification.
Some provider implements this without following the specification.
Who is online
Users browsing this forum: Bing [Bot] and 0 guests