Hi Manuel,

at the moment i can not see any problem at your mapping of CABLE and
CABLE_MATERIAL. On the other hand castor do not support foreign key
being part of primary key which you have suggessfully worked around
between WIRE and CABLE.

For me to be able to further help you with your problem i suggest you to
write a small test case that shows your problem, create a new issue in
jira and attache the testcase there. If possible please follow:

http://castor.codehaus.org/how-to-submit-a-bug.html

Regards
Ralf
Castor JDO, committer


Manuel Castrillon schrieb:
> 
> Hello All,
> 
> Been having some issues with foreign keys and primary keys in my
> database and mapping file
> using Castor 0.9.9.1.  Note I cannot modify the database PK nor FK...
> 
> The problem may be that I am not performing the mapping properly so I
> would like to show what I did using the
> example of 3 tables from my Oracle database.  The problems I am having
> are mainly between CABLE & CABLE_MATERIAL since I am using the FK, in
> this example I do explicitly map the relation between WIRE and CABLE,
> because I was unable to get it to work between CABLE & CABLE_MATERIAL.
> 
> 1. WIRE
> PK,FK CABLE_TYPE
> PK    WIRE_COLOR
>       WIRE_INFO
>      
> 2.  CABLE
> PK    CABLE_TYPE
> FK    CABLE_MATERIAL
>       CABLE_INF! O 
> 
> 3.  CABLE_MATERIAL
> PK   CABLE_MATERIAL
>       MATERIAL_INFO
>      
> My classes look as follows:
> 
> public class MapWire{
> 
>     private String cableType,wireColor;
>     private Integer wireInfo;
>    
>     public String getCableType()   {return cableType;}
>     public String getWireColor()        {return wireColor;}
>  public Integer getWireInfo()   {return wireInfo;}            
>        
>     public void setCableType(String x)  {this.cableType=x;}
>     public void setWireColor(String x)  {this.wireColor=x;}
>  public void setWireInfo(Integer x)  {this.wireInfo=x;}     
>  ! ;          
> }
> 
> 
> public class MapCable{
> 
>     private String  cableType;
>     private Integer cableInfo;
>     private MapCableMaterial cableMaterial;
>  
>     public String getCableType() {return cableType;}
>     public Integer getCableInfo() {return cableInfo;}
>   public MapCableMaterial getCableMaterial() {return cableMaterial;}
> 
>     public void setCableType(String x) {this.cableType=x;}
>     public void setCableInfo(Integer x) {this.cableInfo=x;}
>   public void setCableMaterial(MapCableMaterial x) {this.cableMaterial=x;} 
>          
> }
> 
> public class MapCableMaterial{
> 
>     private String cableMaterial;
>     private MapCable cable;
>     private Integer materialInfo;
>    
>     pub! lic String getCableMaterial() {return cableMaterial;}
>     public MapCable getCable() {return cable;}
>     public Integer getMaterial Info() {return materialInfo;}
>    
>   public void setCableMaterial(String x) {this.cableMaterial = x;}
>   public void setCable(MapCable x) {this.cable = x;}
>     public void setMaterialInfo(Integer x) {this.materialInfo=x;} 
> }                
> 
> XML mapping looks like this:
> 
>     <class name="com.mapping.MapWire" identity="cableType wireColorCode">
>      <cache-type type="unlimited"/>  
>         <map-to table="WIRE"/>
>         <field name="cableType" type="string" required="true">
>      &nb! sp;      <sql name="CABLE_TYPE" type="char [10]" />
>         </field>
>          <field name="wireColor" type="string" required="true">
>             <sql name="WIRE_COLOR" type="char[3]" />
>         </field>
>         <field name="wireInfo" type="integer">
>             <sql name="WIRE_INFO" type="integer" />
>         </field>            
>     </class>  
> 
>    
>     <class name="com.mapping.MapCable" identity="cableType"
> depends="com.airbus.etool.client.mapping.MapCableMaterial">
>      <cache-type type="unlimited"/>!   
>         <map-to table="CABLE"/>
>         <field name="cableType" type="string" required="true">
>             <sql name="CABLE_TYPE" type="char[10]" />
>         </field>
>          <field name="cableInfo" type="integer" >
>             <sql name="CABLE_INFO" type="integer" />
>         </field>      
>         <field name="cableMaterial"
> type="com.airbus.etool.client.mapping.MapCableMaterial">
>             <sql name="CABLE_MATERIAL"/>
>         </field! >               
>     </class>  
> 
> 
>  <class name="com.mapping.MapCableMaterial" identity="cableMaterial">
>      <cache-type type="unlimited"/>  
>         <map-to table="CABLE_MATERIAL"/>
>         <field name="cableMaterial" type="string" required="true">
>             <sql name="CABLE_MATERIAL" type="char[10]"/>
>         </field>
>          <field name="materialInfo" type="integer">
>             <sql name="MATERIAL_INFO" type="integer"/>
>         </field>
> 
>     </class>
>  
> I have been trying different combinati! ons and always getting null
> pointer exceptions: java.lang.NullPointerException   
>    
> Any feedback would be greatly appreciated. 
> 
> Regards,
> 
> Manuel
> 
> 
> 
> Nur bis 31.12.: 1&1 DSL mit WEB.DE Preisvorteil! Jetzt einsteigen    
> und die Vorteile sichern! *http://1und1dsl.web.de/?mc=021130*  
> 

-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to