Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Interface annotation?
Interface annotation? [message #387770] Fri, 08 May 2009 13:13 Go to next message
Ana Oleski is currently offline Ana OleskiFriend
Messages: 22
Registered: July 2009
Junior Member
Hi,

In toplink/eclipselink native there is this advanced feature, where you
can query on an interface.

For instance if Cat and Dog both implement a common interface, say
Lovable, but are mapped in different tables and don't even have a common
superclass you can send a ReadAllQuery(Lovable.class) and get both cats
and dogs.

Can I define this with annotations? I know it's not JPA standard, but I
looked in the JPA Extensions and found VariableOneToOneMapping, which is a
mapping to an interface. So I was wondering if one can annotate an
interface, maybe define its query keys in the annotation, and be able to
query on them. With EJBQL?


In the native project.xml it's something like this

<class-mapping-descriptor
xsi:type="relational-class-mapping-descriptor">
<class>pet.Lovable</class>
..
<query-keys>
<query-key name="sweetnessFactor" xsi:type="query-key"/>
..
</query-keys>
</class-mapping-descriptor>

<class-mapping-descriptor
xsi:type="relational-class-mapping-descriptor">
<class>pet.Cat</class>
..
<interfaces>
<interface>pet.Lovable</interface>
</interfaces>
</class-mapping-descriptor>


Thanx,

Ana
Re: Interface annotation? [message #387779 is a reply to message #387770] Mon, 11 May 2009 13:21 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

EclipseLink does not currently define JPA annotations for interface
descriptors. Please log an enhancement request for this.

Currently you can still define descriptors for interfaces using the code
API and a SessionCustomizer (see, ClassDescriptor, InterfacePolicy).

---
James
http://www.nabble.com/EclipseLink---Users-f26658.html


James : Wiki : Book : Blog : Twitter
Previous Topic:Getting NegativeArraySizeException: allocArray
Next Topic:Expression - dateDifference method usage
Goto Forum:
  


Current Time: Thu Apr 25 04:01:59 GMT 2024

Powered by FUDForum. Page generated in 0.03106 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top