Martin,

On Fri, 09 Jan 2004 20:28:14 +0100, Martin Fuchs wrote:

>Hello,
>
>> thanks fro the patch. Just out of curiosity, could you please describe a
>> scenario when you've been hitting NullPointerExceptions ?  Looking at your
>> patch, 
>> it looks like this could only have happened when one of the members of
>> Complex is null. Which kind of seems to be odd to me as such a scenario
>> simply should not occur. With Complex identifying a compound key, no field must be
>> allowed to be set to null.
>
>Yes, there are some columns null in some rows I retreive from the DB.
>Why shouldn't this be allowed? It works for me.  :-)

If any of these columns are part of an identity (which maps to a primary key), 
shouldn't they be prevented from having a value of NULL ? Just a thought, 
of course ...

Anyhow, can you please open bug report and attach the patch so that we can take care 
of it ?

Werner

>Well, may be it's because I only use read-only access for this class.
>
>This shows the Java code I used:   (all real names changed)
>
>     OQLQuery oql = jdo_db.getOQLQuery(
>       "CALL SQL "+
>               "select distinct col1, col2, col3, col4, col5 "+
>               "from VIEW1 "+
>               "order by 1, 2, 3, 4 "+
>       "AS Classname"
>    );
>
>    QueryResults results = oql.execute(Database.ReadOnly);
>
>
>And this is shows the mapping definition:
>
><class name="Classname" identity="col1 col2 col3 col4 col5">
>    <map-to table="VIEW1"/>
>
>    <field name="col1" type="string" required="true" direct="true">
>        <sql name="COLUMN1" type="char"/>
>    </field>
>
>    <field name="col1" type="string" required="true" direct="true">
>        <sql name="COLUMN2" type="char"/>
>    </field>
>
>    <field name="col3" type="string" required="false" direct="true">
>        <sql name="COLUMN3" type="char"/>
>    </field>
>
>    <field name="col4" type="string" required="false" direct="true">
>        <sql name="COLUMN4" type="char"/>
>    </field>
>
>    <field name="col5" type="string" required="false" direct="true">
>        <sql name="COLUMN5" type="char"/>
>    </field>
></class>
>
>
>> >below I send you a patch for a NullPointer Exception problem that occured
>>  for me when
>> >using castor JDO with multiply-column keys and activated logging.
>> >
>> >
>> >Index: Complex.java
>> >===================================================================
>> >RCS file:
>>  /cvs/castor/castor/src/main/org/exolab/castor/persist/spi/Complexjava,v
>> >retrieving revision 1.2
>> >diff -u -p -d -r1.2 Complex.java
>> >--- Complex.java        3 Mar 2003 09:57:17 -0000       1.2
>> >+++ Complex.java        8 Jan 2004 08:32:24 -0000
>> >@@ -223,8 +223,10 @@ public class Complex {
>> >         sb.append("<");
>> >         for( int i=0; i < _size; i++ ) {
>> >             if ( i != 0 ) sb.append(",");
>> >-            sb.append(get(i));
>> >-            sb.append("("+get(i).hashCode()+")");
>> >+           Object obj = get(i);
>> >+            sb.append(obj);
>> >+           if (obj != null)
>> >+               sb.append("("+obj.hashCode()+")");
>> >         }
>> >         sb.append(">");
>> >         return sb.toString();
>
>----------------------------------------------------------- 
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
>        unsubscribe castor-dev
>

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to