As we continue considering what Persistent Interfaces are really all
about in the 2.1 timeline, let me reiterate my original need /
expectation with this:
If I have a PC class MyPerson that implements persistent interface
Person:
public class Person {}
public class MyPerson implements Person {}
I expect that I should be able to query by the person interface and
retrieve all persistent instances of objects assignable to that
interface:
List<Person> people = (List<Person>) pm.newQuery
(Person.class).execute();
Note here that I'm not using an Extent. Typically, to return
subtypes, we would need to do something like:
pm.newQuery(new Extent(Person.class, true)); //...
However, this makes no sense when the type in question is an
interface. Thus I propose that queries taking interfaces as
parameters implicitly return all implementing persistent instances.
I believe that this scenario represents the most basic, intuitive
kind of use case possible when dealing with interfaces. And, it is
currently not supported.
Note that what I'm talking about here does not take into account any
of the support for implementation generation (pm.newInstance()),
etc.. I consider all that functionality, while perhaps useful, to be
much more advanced.
Thanks,
- Chris
Chris Beams
On Sep 27, 2007, at 2:55 PM, Ilan Kirsh wrote:
Thanks. It might be appropriate to mention persistent interfaces
also in chapter 6.
Ilan
----- Original Message -----
From: Craig L Russell
To: Ilan Kirsh
Cc: [email protected] ; JDO Expert Group
Sent: Wednesday, September 26, 2007 6:00 PM
Subject: Re: Persistence Capable Interfaces and Abstract Classes
Hi Ilan,
You could start with the pm.newInstance method in 12.6.6 that is
the way to instantiate the instances, and then look at the metadata
descriptions in 18.5.
Craig
On Sep 26, 2007, at 2:46 AM, Ilan Kirsh wrote:
I wonder where in the spec persistence capable interfaces and
persistence capable abstract classes are discussed.
I have the Java Data Objects 2.1 specification draft from 13 June
2007, and it seems that relevant sections (e.g. chapter 6) ignore
this issue.
Ilan
Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!