You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Gerardo Arroyo <ge...@flecharoja.com> on 2003/12/30 02:24:27 UTC

Problem with reference-descriptor

Hi,

I had a very unusual problem with the reference-descriptor. I try to
insert a row in the database. There is a varchar-field named
'COD_EXAMEN_FISICO', which is a foreign-key.

OJB returns with an error indicating that the field 'COD_EXAMEN_FISICO'
could not be NULL. Now, I checked the object before the store and the
'COD_EXAMEN_FISICO' is NOT NULL at all; but still the RDBMS report the
error.

I did a simple test, removed the 'reference-descriptor' then tried the
same sentence and work smoothly. I put again the 'reference-descriptor'
and there is no way that I can fix it.

I debugged the source code and the "problem" is in the
assertFkAssignment method at
org.apache.ojb.broker.core.PersistenceBrokerImpl. Is this an error or
the expected behavior? 

The extract of the repository_user.xml is:

  <class-descriptor
     class="com.flecharoja.siis.data.SIIS_EXAMEN_FISICOData"
     table="SIIS_EXAMEN_FISICO"
  >
	<field-descriptor id="1"
		name="DSC_EXAMEN_FISICO"
		column="DSC_EXAMEN_FISICO"
		jdbc-type="VARCHAR"
	/>
	<field-descriptor id="2"
		name="COD_EXAMEN_FISICO"
		column="COD_EXAMEN_FISICO"
		jdbc-type="VARCHAR"
		primarykey="true"
	/>
  </class-descriptor>

  <class-descriptor
     class="com.flecharoja.siis.data.SIIS_EXAMEN_FISICO_PACIENTEData"
     table="SIIS_EXAMEN_FISICO_PACIENTE"
  >
	<field-descriptor id="1"
		name="NUM_IDENTIFICACION"
		column="NUM_IDENTIFICACION"
		jdbc-type="NUMERIC"
		primarykey="true"
	/>
	<field-descriptor id="2"
		name="NUM_CITA"
		column="NUM_CITA"
		jdbc-type="VARCHAR"
		primarykey="true"
	/>
	<field-descriptor id="3"
		name="COD_EXAMEN_FISICO"
		column="COD_EXAMEN_FISICO"
		jdbc-type="VARCHAR"
		primarykey="true"
	/>
	<field-descriptor id="4"
		name="OBS_EXAMEN_FISICO_PACIENTE"
		column="OBS_EXAMEN_FISICO_PACIENTE"
		jdbc-type="VARCHAR"
	/>
	<reference-descriptor name="parentExamen" 
	
class-ref="com.flecharoja.siis.data.SIIS_EXAMEN_FISICOData"
		refresh="true">
	     <foreignkey field-id-ref = "3"/>	 
	</reference-descriptor>
  </class-descriptor>

Note: I also tried with the      <foreignkey field-ref =
"COD_EXAMEN_FISICO"/> I am using OJB 1.0.rc3 -also tried with OJB
1.0.rc5

Thanks in advance!!!
Gerardo


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org