I'm trying to use inheritance within entity beans. The superclass defines a set of CMR methods which should be used in the subclass without the need to declare them in the subclasses again. 1xN relations don't make any trouble i think, but NxM relations will do.
To make my problem a little more concrete:
I have a entity bean called "DeviceBean" and to subclasses "FTPDeviceBean" and "FTAMDeviceBean". Each subclass has a set of additional attributes. All entity beans are mapped in different tables. All entries have a unique id (Integer) which is unique within all device tables.
Next, the "DeviceBean" defines a bidirectional relation to a "PollingCycleBean" which will be mapped in a relation table.
(I hope may bad "ASCII arts" makes my problem clear :)
DeviceBean n<------------------>m PolingCycleBean
|-- FTPDeviceBean -------------------^ should also use relation
|-- FTAMDeviceBean -----------------^ should also use relation
|device_id (pk)| pc_id (pk)|
To use the relation in my subclasses I have to declare the relation in the ejb-jar.xml for each subclass with a unique name.
But next step will make trouble i think. Associating a FTP-device with a new polling cycle will add an entry to the relation table. But can the container make an inverse lookup and return the associated devices (FTP- and FTAM-devices) which are stored in different tables ?
Can I use bidirectional NxM CMR in subclasses with JBoss 3.2 ?
Thanks a lot for bringing some more light in my understanding of the abilities of CMR.
The keys will be loaded from the specified relation table and only from it. The type of returned EJBLocalObject's will be the one of CMR element type, not any other in class hierarchy.