openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matthew <matt...@matthewadams.me>
Subject Persistent interfaces enhancement
Date Thu, 24 Sep 2009 16:27:23 GMT
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:matthew@matthewadams.me
skype:matthewadams12
yahoo:matthewadams
aol:matthewadams12
google-talk:matthewadams12@gmail.com
msn:matthew@matthewadams.me
http://matthewadams.me
http://www.linkedin.com/in/matthewadams

Mime
View raw message