cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pascal Robert <prob...@druide.com>
Subject Re: Object not cached/SELECT on each access
Date Wed, 10 Jan 2018 19:00:37 GMT

> Le 10 janv. 2018 à 11:16, John Huss <johnthuss@gmail.com> a écrit :
> 
> Hard to say.
> 
> Is the shared cache enabled?  

I’m using the default settings.

> Is it sized big enough?

To hold everything? I don’t think so (+470 000 rows from FileMaker). 

> 
> Is the app under memory pressure when this is happening, or is it happening
> all the time?

All the time.

> 
> On Wed, Jan 10, 2018 at 6:35 AM Pascal Robert <probert@druide.com> wrote:
> 
>> Hi,
>> 
>> I’m trying to find out why it takes between 200 and 500 ms to convert an
>> entity coming from FileMaker and commit the « new » entity to MySQL. Found
>> out that every time I access a property of the fetched object, Cayenne does
>> a SELECT query. Example:
>> 
>>   try(ResultBatchIterator<ContactsPrincipaux> batch =
>> ObjectSelect.query(ContactsPrincipaux.class, null,
>> tris).batchIterator(context, 100)) {
>>      for (List<ContactsPrincipaux> contactsPrincipaux: batch) {
>>        for (ContactsPrincipaux contactPrincipalFileMaker:
>> contactsPrincipaux) {
>>          Utilisateur contactPrincipalMySQL =
>> mysqlContext.newObject(Utilisateur.class);
>> 
>> 
>> contactPrincipalMySQL.setNoFilemaker(contactPrincipalFileMaker.getKpCodeContact().longValue());
>> 
>>          LocalDateTime dateCreation =
>> transformeDate(contactPrincipalFileMaker.getZCreationDate(),
>> contactPrincipalFileMaker.getZCreationHeure());
>>          LocalDateTime dateModification =
>> transformeDate(contactPrincipalFileMaker.getZModifDate(),
>> contactPrincipalFileMaker.getZModifHeure());
>> 
>> That would generate 5 SELECT for the same object, because I’m called 5
>> properties on contactPrincipalFileMaker. The SELECT statements are exactly
>> the same (same columns, same primary key). I was reading the guide, and
>> looks like the object should not be refetched by default, so I don’t
>> understand why it’s happening.
>> 
>> 
>> 


Mime
View raw message