cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Huss <johnth...@gmail.com>
Subject Re: Object not cached/SELECT on each access
Date Wed, 10 Jan 2018 16:16:11 GMT
Hard to say.

Is the shared cache enabled?  Is it sized big enough?

Is the app under memory pressure when this is happening, or is it happening
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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message