| interfaces [message #390038] |
Thu, 09 July 2009 16:47  |
Andreas Leue Messages: 6 Registered: July 2009 |
Junior Member |
|
|
Hi,
JPA standard says
"An enum or interface should not be designated as an entity"
I googled a bit around and it seems
http://stackoverflow.com/questions/281503/jpa-mapping-interf aces
it might work somewhere else.
Anyway - how do you do it?
Assuming I have interface Person and implementing classes
Programmer and Manager. Somewhere else, I have an attribute
List<Person>, or a plain attribute Person.
I've read the suggestion to make the interface an abstract class.
Is that the only workaround?
What do you do in case of multiple interfaces? Are you lost then?
Thanks for help,
Andreas
|
|
|
| Re: interfaces [message #390050 is a reply to message #390038] |
Mon, 13 July 2009 10:16   |
James Sutherland Messages: 1834 Registered: July 2009 |
Senior Member |
|
|
JPA does not have support for mapping interfaces, but EclipseLink does
have support for interface descriptor and variable 1-1 mappings.
You can define a OneToOne relationship to an interface using the
@VariableOneToOne EclipseLink annotation.
There is currently no annotation for interface descriptors, but you can
define them using a SessionCustomizer and create a RelationalDescriptor of
interface type (setJavaInterface()).
You could also make it an abstract class, or define an abstract class in
addition to the interface.
---
James
http://www.nabble.com/EclipseLink---Users-f26658.html
James : Wiki : Book : Blog
|
|
|
|
| Re: interfaces [message #390297 is a reply to message #390289] |
Thu, 16 July 2009 10:15   |
James Sutherland Messages: 1834 Registered: July 2009 |
Senior Member |
|
|
The EclipseLink orm.xml support mirrors the EclipseLink annotations, its
schema is in the eclipselink.jar and on the wiki.
Please include your mappings and the full exception stack trace.
James : Wiki : Book : Blog
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01790 seconds