Hi,
My problem: calling create() on a TemplateAssoc gives the error "componentId must not be null" from the JDBC driver - so Castor is not setting the component properly. This is reasonably urgent - so if you are able to help please reply ASAP ;)
My situation: I have a class with a many-to-many assocation thith objects of itself. The association has a property. I use an assocation class to deal with this and model as follows:
PageTemplate { id : int, templateComponents : Collection (of TemplateAssoc) }
TemplateAssoc { id : int, pageId : int, component : PageTemplate, regionCode : int }
I want to get all TemplateAssoc and the components when I load the original PageTemplate. No circular references are possible as components have no sub-components.
Here are some parts of the mapping that are relevant. (Mapping is processed by XSLT, so any DTD fields are entered):
Assoc class:
<field name="component" type="au.com.f2.shopping.page.PageTemplate" required="false" direct="false" lazy="false">
<sql name="componentId" dirty="check"/>
</field>
<field name="pageId" type="integer" required="false" direct="false" lazy="false">
<sql name="pageId" type="integer" dirty="check"/>
</field>
PageTemplate:
<field name="templateComponents" type="au.com.f2.shopping.product.TemplateComponentAssociation" collection="arraylist" lazy="true">
<sql many-key="pageId"/>
</field>
I have checked that the component is correct and has its id set. The castor.log file has:
SQL for creating au.com.f2.shopping.page.PageTemplate: INSERT INTO page_templates(name,inputUrl,outputFilename,publishFlag,component,lastmodified) VALUES (?,?,?,?,?,?)
SQL for loading au.com.f2.shopping.page.PageTemplate: SELECT page_templates.name,page_templates.inputUrl,page_templates.outputFilename,page_templates.publishFlag,page_templates.component,page_templates.lastmodified,template_component_assocs.id FROM page_templates LEFT OUTER JOIN template_component_assocs ON page_templates.id=template_component_assocs.pageId WHERE page_templates.id=?
SQL for creating au.com.f2.shopping.page.TemplateComponentAssociation: INSERT INTO template_component_assocs (componentId,pageId,regionCode,lastmodified) VALUES (?,?,?,?)
SQL for loading au.com.f2.shopping.page.TemplateComponentAssociation: SELECT template_component_assocs.componentId,template_component_assocs.pageId,template_component_assocs.regionCode,template_component_assocs.lastmodified FROM template_component_assocs WHERE template_component_assocs.id=?
...
Castor: Loading au.com.f2.shopping.page.PageTemplate (4)
Castor: Creating au.com.f2.shopping.page.TemplateComponentAssociation (null)
Can anyone help? This is Castor 0.9.3 (not CVS - this is going into production and I'm not comfortable using anything that changes too frequently now :)
Thanks in advance!
Cheers,
Brett
~*~*~*~*~*~*~
Brett Porter - Web Developer
f2 Network ~ everything essential
Ph: +61 2 8596 4437
Email: [EMAIL PROTECTED]
