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.