[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] OneToMany Interface mapping
|
Please log an enhancement request for variable OneToMany and ManyToMany
mappings.
It might actually just work if you define the OneToManyMapping using a
DescriptorCustomizer and set its reference class to Paper and define its
selectionCriteria using query keys.
A workaround is to define a class that maps to a join table, and define a
VariableOneToOne in it.
i.e. Student - OneToMany - PaperAssociation - VariableOneToOne - Paper
Another option is to instead make Paper an abstract class, or define an
abstract class in addition to the interface and map it using TABLE_PER_CLASS
inheritance, or even JOINED or SINGLE_TABLE inheritance.
I suppose you could model it two ways on the database, you could use a join
table and type field, or just a normal 1-m and query each table and union
the result.
Afroozeh wrote:
>
> Hi,
>
> In my current project I must provide header interfaces for my
> entities. For example I have the Paper interface like this:
>
> =======================
> public interface Paper {
> public void submit();
> public String title();
> }
> =======================
>
> I have two different paper implementation and I want to map them to a
> relational database. For one to one operations the @VariableOneToOne
> annotation works well. I wonder why there is no @VariableOneToMany or
> @VariableManyToMany annotation. Somewhere in code I want to map a list
> of papers.
>
> hibernate provides a @ManyToAny annotation that does the work but with
> cost of an intermediate table like many to many relationships.
>
> My first question is how should I do this with EclipseLink? Second, is
> this kind of mapping inherently requires an intermediate table?
>
> Regards
>
>
-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
http://www.eclipse.org/eclipselink/
EclipseLink , http://www.oracle.com/technology/products/ias/toplink/
TopLink
Wiki: http://wiki.eclipse.org/EclipseLink EclipseLink ,
http://wiki.oracle.com/page/TopLink TopLink
Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
http://www.nabble.com/EclipseLink-f26430.html EclipseLink
Book: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
--
View this message in context: http://www.nabble.com/OneToMany-Interface-mapping-tp23149163p23156761.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.