Hi all,

I wanted to see what it would take to enhance the support for
persistent fields of an interface type.

Currently, OpenJPA stringifies the object id of the instance being
stored, rendering the relation unqueriable.  If this could be enhanced
to support the fairly common use case (IMHO) of entities that use
single field identity, the id value and type information could be
separated and stored in two columns.  This would make it possible to
query through the relationship predictably.  I forsee the types of the
columns being string, so as to support any stringifiable single field
identity value and a type.

One possible implementation that puts all of this info in one place
could be this:

// Some class that has a persistent interface field
public class Calendar {
    // ...
    @PersistentInterface({
        @PersistentInterfaceImpl(discriminatorValue="MEETING",
clazz=Meeting.class),
        @PersistentInterfaceImpl(discriminatorValue="APPOINTMENT",
clazz=Appointment.class)
    })
    protected Schedulable schedulable;
}

In this manner, queries across persistent interfaces becomes a bit
more predictable and, probably more importantly, the storage of an
interface type becomes much more palatable to a DBA.  A stringified
version of the object id, which includes its Java class information,
is certainly not something many DBAs would like.

Thoughts?

-matthew

-- 
mailto:[email protected]
skype:matthewadams12
yahoo:matthewadams
aol:matthewadams12
google-talk:[email protected]
msn:[email protected]
http://matthewadams.me
http://www.linkedin.com/in/matthewadams

Reply via email to