Title: Odd "Type conversion error" case

I'm getting the following error when I try to load custom object that references another custom object as a property:
----
org.exolab.castor.jdo.DataObjectAccessException: Type conversion error:
could not set value of FieldMolder of clubmom.cms.ContentItem.setfunction(clubmom.cms.ContentFunction
function) with value of type clubmom.cms.ContentFunction
        at org.exolab.castor.persist.FieldMolder.setValue(Unknown Source)
        at org.exolab.castor.persist.ClassMolder.load(Unknown Source)
        at org.exolab.castor.persist.LockEngine.load(Unknown Source)
        at org.exolab.castor.persist.TransactionContext.load(Unknown Source)
        at org.exolab.castor.persist.TransactionContext.load(Unknown Source)
        at org.exolab.castor.jdo.engine.DatabaseImpl.load(Unknown Source)
        at org.exolab.castor.jdo.engine.DatabaseImpl.load(Unknown Source)
        [etc]
----
I've checked over the back mailing-list records, and while I've seen some posts addressing similar-seeming issues, they always differ in the classes of the expected vs. actual objects used in the setter.  As far as I can tell, the correct type _is_ being returned.  I've explicitly turned off lazy loading as suggested by Clemens Marschner on 5/29/2002.  Any help would be greatly appreciated.

Here's the code snippet:

      org.exolab.castor.jdo.Database db = clubmom.cms.ContentDatabaseUtils.getDB();
      db.begin();
      Class c = Class.forName("clubmom.cms.ContentItem");
      Object o1 = session.getAttribute("lastModifiedContentItemId");
      Object o2 = db.load(c, o1);
      request.setAttribute("lastModifiedContentItem", (clubmom.cms.ContentItem) o2);
      db.commit();
      db.close();

The static getDB() method works well in other scenerios, and I tried with a standard JDO -> DB sequence just to see if that was the problem.  The database is populated, and it's worthy of mention that an _insert_ of the clubmom.cms.ContentItem worked to enter the record in the first place.

The relevant mapping files follow:
       
        <class name="clubmom.cms.ContentFunction" identity="functionId">       
                <map-to table="FUNCTIONS"/>    
                <field name="functionId" type="integer">
                        <sql name="FUNCTION_ID"/>
                </field>       
                <field name="name" type="string">
                        <sql name="NAME"/>
                </field>       
                <field name="displayName" type="string">
                        <sql name="DISPLAY_NAME"/>
                </field>       
                <field name="dataType" type="string">
                        <sql name="DATA_TYPE"/>
                </field>       
                <field name="lookupParamName" type="string">
                        <sql name="LOOKUP_PARAM"/>
                </field>       
                <field name="lookupParamValue" type="string">
                        <sql name="LOOKUP_PARAM_VALUE"/>
                </field>
        </class>
        <class name="clubmom.cms.ContentItem" identity="itemId" key-generator="CONTENT_IDS">
                <map-to table="ITEMS"/>
                <field name="itemId" type="integer">
                        <sql name="ITEM_ID"/>
                </field>       
                <field name="displayName" type="string">
                        <sql name="DISPLAY_NAME"/>
                </field>       
                <field name="location" type="string">
                        <sql name="LOCATION"/>
                </field>       
                <field name="function" type="clubmom.cms.ContentFunction" lazy="false">
                        <sql name="FUNCTION_ID"/>
                </field>               
                <field name="sourceId" type="string">
                        <sql name="SOURCE_ID"/>
                </field>
                <field name="calloutTemplate" type="string">
                        <sql name="DEFAULT_CALL_OUT_TEMPLATE"/>
                </field>
                <field name="displayTemplate" type="string">
                        <sql name="DEFAULT_DISPLAY_TEMPLATE"/>
                </field>
                <field name="navTemplate" type="string">
                        <sql name="DEFAULT_NAV_TEMPLATE"/>
                </field>
                <field name="relateTemplate" type="string">
                        <sql name="DEFAULT_RELATE_TO_TEMPLATE"/>
                </field>       
                <field name="isDeleted" type="boolean">
                        <sql name="DELETED"/>
                </field>       
                <field name="owner" type="string">
                        <sql name="OWNER"/>
                </field>       
                <field name="lastUpdate" type="date" >
                        <sql name="LAST_UPDATE" type="timestamp"/>
                </field>
                <field name="lastUpdatedBy" type="string">
                        <sql name="LAST_UPDATED_BY"/>
                </field>
        </class>


Ben Cochran
Senior Interface Engineer
ClubMom, Inc.
200 Madison Avenue, 6th Floor
New York, New York 10016
tel   646.435.6508
fax  646.435.6500

Reply via email to