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 katarn <ka...@racsa.co.cr> on 2003/12/29 23:13:42 UTC

OQLQuery being cached? [orb newbie]

Hi,

I am executing the following code:

   OQLQuery query = impl.newOQLQuery();
   query.create( [THEQUERY] );
   DList results = (DList)query.execute();
   Iterator iterator = results.iterator();

If I change some column with an external tool and then execute the code, 
the updated column is not reflected in the orb objects.

Is there a config value or a runtime parameter that I need to change? 
What is going on behind the scenes here?

Thanks for your help,

K.



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


Problem with reference-descriptor

Posted by Gerardo Arroyo <ge...@flecharoja.com>.
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


Re: OQLQuery being cached? [orb newbie]

Posted by ed...@mgrinformatica.com.br.
In real, I'm not an specialist in caches ;), but I've used with success <object-cache ..>
tag inside class-descriptor, no elsewhere.

I think I've read somewhere that is possible to configure the object-cache for the
connection (or the alias), but I never reade more, and now I'm not sure. Give a try to DTD
doc. Is the first place I look when in doubt.

Best regards,

Edson Richter


> Thanks for your quick answer, I cheched the OJB.properties file an "I"
> was using DefaultCacheImpl  I change it to ObjectCacheEmptyImpl and now
> it is working as I was expecting.
>
> Now just to learn the reasons for the previous behaviour:
>
> A comment in OJB.properties:
>         # The ObjectCacheClass entry tells OJB which concrete ObjectCache
>         # implementation is to be used as standard cache.
>         # Its also possible to override this entry adding object-cache
> elements
>         # on jdbc-connection-descriptor level and
>         # per class-descriptor in repository file
>
> In  my repository_internal.xml I have the following line:
>
>     <object-cache class="org.apache.ojb.broker.cache.ObjectCacheEmptyImpl">
>     </object-cache>
>
> Why it wasn't working as I was expecting?
> Where is the documentation about the config parameters for the cache
> implementations?
>
> Thanks for your help,
>
> K.
>
>
> edson.richter@mgrinformatica.com.br wrote:
>
>>Are you working with DefaultCacheImpl or EmptyCacheImpl?
>>If you are working with DefaultCacheImpl, take a look at config parameters.
>>Otherwise, are there any exceptions (stack trace), messages (they can be very usefull if
>> you
>>enable higher level of logging as DEBUG).
>>
>>Best regards,
>>
>>Edson Richter
>>
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


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


Re: OQLQuery being cached? [orb newbie]

Posted by katarn <ka...@racsa.co.cr>.
Thanks for your quick answer, I cheched the OJB.properties file an "I" 
was using DefaultCacheImpl  I change it to ObjectCacheEmptyImpl and now 
it is working as I was expecting.

Now just to learn the reasons for the previous behaviour:

A comment in OJB.properties:
        # The ObjectCacheClass entry tells OJB which concrete ObjectCache
        # implementation is to be used as standard cache.
        # Its also possible to override this entry adding object-cache 
elements
        # on jdbc-connection-descriptor level and
        # per class-descriptor in repository file

In  my repository_internal.xml I have the following line:

    <object-cache class="org.apache.ojb.broker.cache.ObjectCacheEmptyImpl">
    </object-cache>

Why it wasn't working as I was expecting?
Where is the documentation about the config parameters for the cache 
implementations?

Thanks for your help,

K.


edson.richter@mgrinformatica.com.br wrote:

>Are you working with DefaultCacheImpl or EmptyCacheImpl?
>If you are working with DefaultCacheImpl, take a look at config parameters.
>Otherwise, are there any exceptions (stack trace), messages (they can be very usefull if you
>enable higher level of logging as DEBUG).
>
>Best regards,
>
>Edson Richter
>
>
>  
>



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


Re: OQLQuery being cached? [orb newbie]

Posted by ed...@mgrinformatica.com.br.
Are you working with DefaultCacheImpl or EmptyCacheImpl?
If you are working with DefaultCacheImpl, take a look at config parameters.
Otherwise, are there any exceptions (stack trace), messages (they can be very usefull if you
enable higher level of logging as DEBUG).

Best regards,

Edson Richter


> Hi,
>
> I am executing the following code:
>
>    OQLQuery query = impl.newOQLQuery();
>    query.create( [THEQUERY] );
>    DList results = (DList)query.execute();
>    Iterator iterator = results.iterator();
>
> If I change some column with an external tool and then execute the code,
> the updated column is not reflected in the orb objects.
>
> Is there a config value or a runtime parameter that I need to change?
> What is going on behind the scenes here?
>
> Thanks for your help,
>
> K.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


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