users@glassfish.java.net

JPA mapping, dummy list?

From: <glassfish_at_javadesktop.org>
Date: Mon, 26 May 2008 03:23:28 PDT

Hello,

Here is the case:
The object model.
[MyObject] (1)-----(1) [DataList] (1) ----- (0..*) [Data]

Here are the classes (simplified for better overview)

[code]
public class MyObject {
    DataList dataList;
}
public class DataList {
    List<Data> data;
}
public class Data {
    ....
}
[/code]

The DataList class just holds a list of Data. You could say: why don't you put the list of Data in MyObject class then? The reason is that I need the DataList class for XML mapping and I want to use the same classes for the JPA mapping.

Now the problem is that mapping DataList also as a database table would be nothing but overhead. In the database I would like to make it look something like:
[MyObject](1)-----(0..*)[Data] and map it to the above mentioned object model.
I couldn't find a way to do this.
Is there a way to map this using JPA?

Thanks in advance.
[Message sent by forum member 'marlor' (marlor)]

http://forums.java.net/jive/thread.jspa?messageID=276552