I am still struggling with this, so I thought maybe I could try to re-state it
in a way that is a little more clear.
I have two objects, Incident and Participating_Center that I am trying to map to
a database. A many-to-many relationship should exist between these two objects.
However, when I run Castor XML to generate my Java objects, I don't get a
Participating_Center java.util.vector in my Incident object, instead I get a
Participating_CenterList java.util.vector. So, question #1 would be should my
<field> element in my mapping file be Participating_Center or
Participating_CenterList. I suspect Participating_CenterList since there is no
Participating_Center variable.
Assuming Participating_CenterList is the correct <field> name, Castor JDO then
expects a getParticipating_CenterList method. The methods that are generated
for working with this vector do not use ParticipatingCenterList in their names.
The methods are as follows:
public void addParticipating_Center(Participating_Center
vParticipating_Center)
public void addParticipating_Center(int index, Participating_Center
vParticipating_Center)
public java.util.Enumeration enumerateParticipating_Center()
public Participating_Center getParticipating_Center(int index)
public Participating_Center[] getParticipating_Center()
public int getParticipating_CenterCount()
public void removeAllParticipating_Center()
public Participating_Center removeParticipating_Center(int index)
If I try to use the get-method and set-method field properties (using
addParticipating_Center and getParticipating_Center respectively), I get an
error stating "the return type for the method Participating_Center
Incident.getParticipating_Center() does not match the declared field type
java.util.Vector". My mapping at this time looks like this:
<class name="Incident">
<field name="participating_CenterList" type="test.Participating_Center"
required="true"
get-method="getParticipating_Center"
set-method="setParticipating_Center"
collection="vector">
<sql many-key="agencyid">
</field>
</class>
I have tried changing the return type of getParticipatingCenter to
java.util.Vector, which gives me the same error. This leads me to believe that
the error isn't with the methods in the Incident object. Do I need to add code
to my Participating_Center object to support this relationship? There is
nothing in the Participating_Center object that refers back to the Incident
object.
Again, thanks in advance for any help.
Dennis Brundage
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev