I have an application that has various reference data classes. For the most
part, the reference data classes are very similar, so I have a class
structure of (for example).
AuditedObject
^
|
ReferenceData
^ ^
| |
Availability CallType
The availability and call type entity beans live in their own database
tables, using EJB 2.0 persistence.
Since all these beans are very similar, I would like to provide an abstract
interface to my operations beans for general tasks like getting a list of
reference data items, and so on. That way, I could name the class of
reference data that I want and use an ejb-ref to get the appropriate home
interface. Something like:
/**
* @ejb.ejb-ref
* ejb-name="Availability"
* view-type="local"
* ref-name="ejb/Availability"
*/
public ReferenceData getReferenceData(String bean, String id) {
InitialContext ctx = new InitialContext();
ReferenceDataHome home = ctx.lookup("java:comp/env/ejb/" + bean);
return home.findById(id);
}
To do this, I put
/**
* @ejb.finder
* signature="org.charvolant.callout.referencedata.ReferenceData
findById(java.lang.String id)"
* unchecked="true"
*/
in the ReferenceDataBean.java file and
/**
* @ejb.finder
* signature="org.charvolant.callout.referencedata.ReferenceData
findById(java.lang.String id)"
* unchecked="true"
* query="select object(b) from Availability b where b.idField = ?1"
*/
in the Availability.java file. Which I would have thought would have
generated me suitably consistent method signatures and an appropriate finder
for .
However, the 1.2beta3 XDoclet-generated AvailabilityHome.java always
contains the signature
public org.charvolant.callout.referencedata.Availability
findById(java.lang.String id)
throws javax.ejb.FinderException;
which causes a type clash with the generated ReferenceDataHome.java, which
contains
public org.charvolant.callout.referencedata.ReferenceData
findById(java.lang.String id)
throws javax.ejb.FinderException;
I can work around this by having a big pile of if-then-elses. But it's ugly
and seems to fly in the face of good design. Have I missed some subtlety of
the EJB spec or XDoclet?
-------------------------------------------------------
This SF.net email is sponsored by OSDN developer relations
Here's your chance to show off your extensive product knowledge
We want to know what you know. Tell us and you have a chance to win $100
http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user