1 Reply Latest reply on Jul 9, 2003 8:13 AM by Thomas Lauerbach

    Null pointer of reading field

    Ed Ross Newbie

      When trying to read a field that has a null in the database I get the following error

      05:44:02,206 ERROR [LogInterceptor] TransactionRolledbackLocalException, causedBy:
      at techrx.ejb.PatientCMP$Proxy.getSourcePharmacyId()
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityContainer.java:1044)

      The field is defined as an int
      (in this case pharmacyId in null) which explicitly allows nulls. If there is a value in the field, all is well, if there is a null in the field then error. I seem to get this on all fields that have nulls in them.

      Using sybase (but the same problem appears when I use mySql)

      The bean has the follwing:

      * Returns the sourcePharmacyId
      * @todo support OracleClob,OracleBlob on WLS
      * @return the sourcePharmacyId
      * @ejb.interface-method view-type="local"
      * @ejb.persistent-field
      * @ejb.persistence column-name="source_pharmacy_id"
      public abstract int getSourcePharmacyId();

      * Sets the sourcePharmacyId
      * @param sourcePharmacyId the new sourcePharmacyId value
      * @ejb.interface-method view-type="local"
      public abstract void setSourcePharmacyId(int sourcePharmacyId);

      (as you might detect - using xdoclet to gen the code)

      the generated ejb-jar.xml has

      <cmp-field >
      <![CDATA[Returns the sourcePharmacyId]]>

      the jbosscmp-jdbc.xml has:



      The same problem exists with all fields that have nulls.

      I can not regenerate the database as there are millions of rows (well, on the test system 1000's, but still need the data for testing)

      I'm rather new to jboss, so hope this is a simple question.