Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Interface annotation?
Interface annotation? [message #387770] Fri, 08 May 2009 09:13 Go to next message
Eclipse UserFriend
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 09:21 Go to previous message
Eclipse UserFriend
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
Previous Topic:Getting NegativeArraySizeException: allocArray
Next Topic:Expression - dateDifference method usage
Goto Forum:
  


Current Time: Fri Jul 25 01:40:13 EDT 2025

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

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

Back to the top