[1.5.4 / Classic UI] What would cause an edit screen spawned from a table to NOT get current version of the edited entity?

So I have a composition table on an edit screen; very normal arrangement. This table is on a tab, as are many other tables on other tabs - but this one, when I edit one of the instances displayed on the table and hit ok from the edit screen - the edits show back on the table itself, but if I then go back into the editor before saving the whole screen (imagine it’s a note and you wanted to add more to it before saving), the editor opens with the OLD version of the entity, as if I’d never made the edits.

This is the only table I have that is behaving this way - all the others, if I edit an instance, go back in to the editor, it shows the edits I made, even before saving the entire screen. I cannot find any difference between the tables. (So I have to ass-u-me it’s something to do with the editor screen perhaps? But there’s nothing weird there either.)

I cannot produce a small example; a minimal one I made works fine. There are too many entities (dozens++) to produce a full example.

I just need pointers of where to start looking to figure this out.

It gets ever weirder: this works just fine when run deployed in a container running Tomcat. But not when run from IntelliJ with the normal Shift-F10. Doesn’t seem to be Java version dependent either.

The weirdness continues! I put logging.level.eclipselink.logging.sql = debug into application.properties to see if for some reason this particular screen was just ALWAYS re-loading the instance from the DB, and I found that indeed it is.

BUT KEEP IN MIND THIS IS ONLY HAPPENING WHEN RUNNING FROM INSIDE INTELLIJ! It works as expected when deployed to a container. (It also doesn’t work correctly if I generate a .jar and run java -jar jar.file.)

Here is the logs from clicking “Edit” on a WORKING Table → Editor pair on the same screen. Before changing the instance, it will always load it from the DB, but once it’s changed, it does not:

(The “[P] Screen” and similar log lines are just log.info() calls I’ve put in to mark. P screen is the parent, patient screen, A screen is the child, Address screen. This is the pair that works correctly.)

First time, before the instance is changed:

2023-10-05 08:47:10.054  INFO 2287205 --- [nio-8080-exec-7] c.m.m.web.screens.patient.PatientEdit    : [P Screen] Zip = [47960], instance = [com.medflex.medflexj.entity.patient.PatientAddress-5cfbdf54-750d-d62b-7ea4-08bc9010090e [detached]], version = [1]
2023-10-05 08:47:10.077 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 1938591947> SELECT ID, ADDRESS_LINE1, ADDRESS_LINE2, CITY, CREATE_TS, CREATED_BY, DELETE_TS, DELETED_BY, STATE, UPDATE_TS, UPDATED_BY, VERSION, ZIP, PATIENT_ID FROM MEDFLEXJ_PATIENT_ADDRESS WHERE ((ID = ?) AND (DELETE_TS IS NULL))
	bind => [5cfbdf54-750d-d62b-7ea4-08bc9010090e]
2023-10-05 08:47:10.078 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 1938591947> [1 ms] spent
2023-10-05 08:47:10.078 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 427125818> SELECT ID, DELETE_TS, DELETED_BY, FIRST_NAME, LAST_NAME, VERSION, GENDER_ID, LANGUAGE_ID, MARITAL_STATUS_ID, ALTERNATE_ADDRESS_ID, CURRENT_ADDRESS_ID, FORMER_ADDRESS_ID FROM MEDFLEXJ_PATIENT WHERE ((ID = ?) AND (0=0))
	bind => [61fc3e9b-8911-d491-838d-8c088c1836ec]
2023-10-05 08:47:10.078 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 427125818> [0 ms] spent
2023-10-05 08:47:10.081  INFO 2287205 --- [nio-8080-exec-7] c.m.m.w.s.p.PatientAddressEdit           : [A Screen] Zip = [47960], instance = [com.medflex.medflexj.entity.patient.PatientAddress-5cfbdf54-750d-d62b-7ea4-08bc9010090e [detached]], version = [1]

Once the instance is changed:

2023-10-05 08:49:01.460  INFO 2287205 --- [nio-8080-exec-7] c.m.m.web.screens.patient.PatientEdit    : [P Screen] Zip = [47960-1234], instance = [com.medflex.medflexj.entity.patient.PatientAddress-5cfbdf54-750d-d62b-7ea4-08bc9010090e [detached]], version = [1]
2023-10-05 08:49:01.500  INFO 2287205 --- [nio-8080-exec-7] c.m.m.w.s.p.PatientAddressEdit           : [A Screen] Zip = [47960-1234], instance = [com.medflex.medflexj.entity.patient.PatientAddress-5cfbdf54-750d-d62b-7ea4-08bc9010090e [detached]], version = [1]

Note that once the Address instance is changed, the editor screen isn’t triggering any SQL to reload the instance, and the proper, changed instance is used and edited.

Now the non-working Table → Editor pair. Note these are on the SAME screen.

First time, before the instance (in this case a Note) is changed:

2023-10-05 08:50:40.184  INFO 2287205 --- [nio-8080-exec-9] c.m.m.web.screens.patient.PatientEdit    : [P Screen] Text = [qaz], instance = [com.medflex.medflexj.entity.PatientNotes-139afd20-fef4-5713-061d-85282acba0fb [detached]], version = [4]
2023-10-05 08:50:40.200 DEBUG 2287205 --- [nio-8080-exec-9] eclipselink.logging.sql                  : <t 294561575, conn 680893444> SELECT ID, COMPLETED, COMPLETED_INITIALS_LEGACY, COMPLETED_ON, CREATE_TS, CREATED_BY, CRITICAL_FOR_BILLING, CRITICAL_FOR_PURCHASING, DATE_, DELETE_TS, DELETED_BY, DUE_DATE, LEGACY_RECNUM, STEP_ORDER, TEXT, UPDATE_TS, UPDATED_BY, VERSION, INVOICE_ID, NOTE_TYPE_ID, PATIENT_ID FROM MEDFLEXJ_PATIENT_NOTES WHERE ((ID = ?) AND (DELETE_TS IS NULL))
	bind => [139afd20-fef4-5713-061d-85282acba0fb]
2023-10-05 08:50:40.201 DEBUG 2287205 --- [nio-8080-exec-9] eclipselink.logging.sql                  : <t 294561575, conn 680893444> [1 ms] spent
2023-10-05 08:50:40.201 DEBUG 2287205 --- [nio-8080-exec-9] eclipselink.logging.sql                  : <t 294561575, conn 1208661778> SELECT ID, DELETE_TS, DELETED_BY, FIRST_NAME, LAST_NAME, VERSION, GENDER_ID, LANGUAGE_ID, MARITAL_STATUS_ID, ALTERNATE_ADDRESS_ID, CURRENT_ADDRESS_ID, FORMER_ADDRESS_ID FROM MEDFLEXJ_PATIENT WHERE ((ID = ?) AND (0=0))
	bind => [61fc3e9b-8911-d491-838d-8c088c1836ec]
2023-10-05 08:50:40.201 DEBUG 2287205 --- [nio-8080-exec-9] eclipselink.logging.sql                  : <t 294561575, conn 1208661778> [0 ms] spent
2023-10-05 08:50:40.201 DEBUG 2287205 --- [nio-8080-exec-9] eclipselink.logging.sql                  : <t 294561575, conn 825448164> SELECT ID, DELETE_TS, DELETED_BY, NUMBER_, PHASE, RESPONSIBILITY, VERSION, DEVICE_TYPE_ID, GUARANTOR_ID, LOCATION_ID, PATIENT_ID, PRACTITIONER_ID, REGISTRATION_ID, RESPONSIBLE_INSURANCE_ID, SERVICE_SITE_ID, RECEIVABLE_LEDGER_TRANSACTION_ID FROM MEDFLEXJ_INVOICE WHERE ((PATIENT_ID = ?) AND (DELETE_TS IS NULL)) ORDER BY NUMBER_ ASC
	bind => [61fc3e9b-8911-d491-838d-8c088c1836ec]
2023-10-05 08:50:40.202 DEBUG 2287205 --- [nio-8080-exec-9] eclipselink.logging.sql                  : <t 294561575, conn 825448164> [1 ms] spent
2023-10-05 08:50:40.202 DEBUG 2287205 --- [nio-8080-exec-9] eclipselink.logging.sql                  : <t 294561575, conn 1968304791> SELECT ID, DELETE_TS, DELETED_BY, SEQUENCE, VERSION, CARRIER_ID, POLICY_HOLDER_ID, REGISTRATION_ID FROM MEDFLEXJ_REGISTRATION_INSURANCE WHERE ((ID = ?) AND (0=0))
	bind => [e28778de-0bff-060b-5a00-47dac31269ac]
2023-10-05 08:50:40.202 DEBUG 2287205 --- [nio-8080-exec-9] eclipselink.logging.sql                  : <t 294561575, conn 1968304791> [0 ms] spent
2023-10-05 08:50:40.202 DEBUG 2287205 --- [nio-8080-exec-9] eclipselink.logging.sql                  : <t 294561575, conn 1799253364> SELECT ID, DELETE_TS, DELETED_BY, NAME, VERSION, BILLING_FORM_ID, CARRIER_FAMILY_ID, CARRIER_FOR_ALLOWABLES_ID, CARRIER_FOR_PRICE_ID, CONTRACT_ID, LOCATION_FOR_ELECTRONIC_BILLING_ID, ELECTRONIC_PROCESSOR_ID, PAY_SOURCE_ID, PRICE_LEVEL_ID FROM MEDFLEXJ_CARRIER WHERE ((ID = ?) AND (0=0))
	bind => [7f88207e-ae8b-2f60-4dc9-c279c68bfed2]
2023-10-05 08:50:40.203 DEBUG 2287205 --- [nio-8080-exec-9] eclipselink.logging.sql                  : <t 294561575, conn 1799253364> [1 ms] spent
2023-10-05 08:50:40.203 DEBUG 2287205 --- [nio-8080-exec-9] eclipselink.logging.sql                  : <t 294561575, conn 123935186> SELECT ID, DELETE_TS, DELETED_BY, DESCRIPTION, VERSION FROM MEDFLEXJ_NOTE_TYPE WHERE ((ID = ?) AND (0=0))
	bind => [76bf84bd-2f4b-bd06-5905-9d68571eae28]
2023-10-05 08:50:40.203 DEBUG 2287205 --- [nio-8080-exec-9] eclipselink.logging.sql                  : <t 294561575, conn 123935186> [0 ms] spent
2023-10-05 08:50:40.203 DEBUG 2287205 --- [nio-8080-exec-9] eclipselink.logging.sql                  : <t 294561575, conn 839034080> SELECT ID, DELETE_TS, DELETED_BY, VERSION, PATIENT_NOTE_ID, DOCUMENT_ID FROM MEDFLEXJ_PATIENT_NOTE_DOCUMENT WHERE ((PATIENT_NOTE_ID = ?) AND (DELETE_TS IS NULL))
	bind => [139afd20-fef4-5713-061d-85282acba0fb]
2023-10-05 08:50:40.203 DEBUG 2287205 --- [nio-8080-exec-9] eclipselink.logging.sql                  : <t 294561575, conn 839034080> [0 ms] spent
2023-10-05 08:50:40.215 DEBUG 2287205 --- [nio-8080-exec-9] eclipselink.logging.sql                  : <t 294561575, conn 1863700925> SELECT ID, DELETE_TS, DELETED_BY, DESCRIPTION, VERSION FROM MEDFLEXJ_NOTE_TYPE WHERE (DELETE_TS IS NULL)
2023-10-05 08:50:40.215 DEBUG 2287205 --- [nio-8080-exec-9] eclipselink.logging.sql                  : <t 294561575, conn 1863700925> [0 ms] spent
2023-10-05 08:50:40.231  INFO 2287205 --- [nio-8080-exec-9] c.m.m.w.s.patientnotes.PatientNotesEdit  : [N Screen] Text = [qaz], instance = [com.medflex.medflexj.entity.PatientNotes-139afd20-fef4-5713-061d-85282acba0fb [detached]], version = [4]

After the note instance is changed:

2023-10-05 08:52:02.097  INFO 2287205 --- [nio-8080-exec-7] c.m.m.web.screens.patient.PatientEdit    : [P Screen] Text = [qazwsx], instance = [com.medflex.medflexj.entity.PatientNotes-139afd20-fef4-5713-061d-85282acba0fb [detached]], version = [4]
2023-10-05 08:52:02.115 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 552085039> SELECT ID, COMPLETED, COMPLETED_INITIALS_LEGACY, COMPLETED_ON, CREATE_TS, CREATED_BY, CRITICAL_FOR_BILLING, CRITICAL_FOR_PURCHASING, DATE_, DELETE_TS, DELETED_BY, DUE_DATE, LEGACY_RECNUM, STEP_ORDER, TEXT, UPDATE_TS, UPDATED_BY, VERSION, INVOICE_ID, NOTE_TYPE_ID, PATIENT_ID FROM MEDFLEXJ_PATIENT_NOTES WHERE ((ID = ?) AND (DELETE_TS IS NULL))
	bind => [139afd20-fef4-5713-061d-85282acba0fb]
2023-10-05 08:52:02.116 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 552085039> [1 ms] spent
2023-10-05 08:52:02.116 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 2033159761> SELECT ID, DELETE_TS, DELETED_BY, FIRST_NAME, LAST_NAME, VERSION, GENDER_ID, LANGUAGE_ID, MARITAL_STATUS_ID, ALTERNATE_ADDRESS_ID, CURRENT_ADDRESS_ID, FORMER_ADDRESS_ID FROM MEDFLEXJ_PATIENT WHERE ((ID = ?) AND (0=0))
	bind => [61fc3e9b-8911-d491-838d-8c088c1836ec]
2023-10-05 08:52:02.116 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 2033159761> [0 ms] spent
2023-10-05 08:52:02.116 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 558463881> SELECT ID, DELETE_TS, DELETED_BY, NUMBER_, PHASE, RESPONSIBILITY, VERSION, DEVICE_TYPE_ID, GUARANTOR_ID, LOCATION_ID, PATIENT_ID, PRACTITIONER_ID, REGISTRATION_ID, RESPONSIBLE_INSURANCE_ID, SERVICE_SITE_ID, RECEIVABLE_LEDGER_TRANSACTION_ID FROM MEDFLEXJ_INVOICE WHERE ((PATIENT_ID = ?) AND (DELETE_TS IS NULL)) ORDER BY NUMBER_ ASC
	bind => [61fc3e9b-8911-d491-838d-8c088c1836ec]
2023-10-05 08:52:02.116 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 558463881> [0 ms] spent
2023-10-05 08:52:02.117 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 163764665> SELECT ID, DELETE_TS, DELETED_BY, SEQUENCE, VERSION, CARRIER_ID, POLICY_HOLDER_ID, REGISTRATION_ID FROM MEDFLEXJ_REGISTRATION_INSURANCE WHERE ((ID = ?) AND (0=0))
	bind => [e28778de-0bff-060b-5a00-47dac31269ac]
2023-10-05 08:52:02.117 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 163764665> [0 ms] spent
2023-10-05 08:52:02.117 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 947395487> SELECT ID, DELETE_TS, DELETED_BY, NAME, VERSION, BILLING_FORM_ID, CARRIER_FAMILY_ID, CARRIER_FOR_ALLOWABLES_ID, CARRIER_FOR_PRICE_ID, CONTRACT_ID, LOCATION_FOR_ELECTRONIC_BILLING_ID, ELECTRONIC_PROCESSOR_ID, PAY_SOURCE_ID, PRICE_LEVEL_ID FROM MEDFLEXJ_CARRIER WHERE ((ID = ?) AND (0=0))
	bind => [7f88207e-ae8b-2f60-4dc9-c279c68bfed2]
2023-10-05 08:52:02.117 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 947395487> [0 ms] spent
2023-10-05 08:52:02.117 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 943732159> SELECT ID, DELETE_TS, DELETED_BY, DESCRIPTION, VERSION FROM MEDFLEXJ_NOTE_TYPE WHERE ((ID = ?) AND (0=0))
	bind => [76bf84bd-2f4b-bd06-5905-9d68571eae28]
2023-10-05 08:52:02.117 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 943732159> [0 ms] spent
2023-10-05 08:52:02.117 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 1512455888> SELECT ID, DELETE_TS, DELETED_BY, VERSION, PATIENT_NOTE_ID, DOCUMENT_ID FROM MEDFLEXJ_PATIENT_NOTE_DOCUMENT WHERE ((PATIENT_NOTE_ID = ?) AND (DELETE_TS IS NULL))
	bind => [139afd20-fef4-5713-061d-85282acba0fb]
2023-10-05 08:52:02.118 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 1512455888> [1 ms] spent
2023-10-05 08:52:02.124 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 102750355> SELECT ID, DELETE_TS, DELETED_BY, DESCRIPTION, VERSION FROM MEDFLEXJ_NOTE_TYPE WHERE (DELETE_TS IS NULL)
2023-10-05 08:52:02.124 DEBUG 2287205 --- [nio-8080-exec-7] eclipselink.logging.sql                  : <t 615477609, conn 102750355> [0 ms] spent
2023-10-05 08:52:02.132  INFO 2287205 --- [nio-8080-exec-7] c.m.m.w.s.patientnotes.PatientNotesEdit  : [N Screen] Text = [qaz], instance = [com.medflex.medflexj.entity.PatientNotes-139afd20-fef4-5713-061d-85282acba0fb [detached]], version = [4]

Note the “Text” showing in the log.info() calls - the P screen has the correct, edited value - while the N screen does not, because it is re-loading the instance from the DB every time.

And also note this DOES not happen when deployed to a Tomcat container. (Tomcat 9.0.67, though I doubt the Tomcat version could cause this odd behavior.)

Any ideas here? This is mega-weird!

Did you use any annotations that affects transaction behaviour? Any custom loaders involved?
Compare entities definition with the ones that are working.
Delete views and entities in question and recreate.
Purge IntelliJ cache, like the last time…

1 Like

Ideas? :slight_smile:

“Now the non-working Table → Editor pair. Note these are on the SAME screen.”
→ so what happens if you generate them to have table and edit screens separated?

Sorry for the lack of clarity - the non working table is on the same screen as the working tables.

OK so you have then some screen, that has many tables on it, and each or most of the tables then have edit screen?

  • delete non working table, then add some new test table just to see if its about number of tables on the same screen
  • are those tables having their underlying entites in some kind of relationship, like one to many, and the non working one doesn’t have such relationship?

Recently there was IntelliJ update, are you using this newest version, or older one?
Also, I understand from your post that when you deploy on Tomcat, it works, while when using IntelliJ internal web server it doesn’t → so make yourself some development tomcat server and use that, this looks too complex to dive into, and will probably fix itself with future updates.

You can install Docker Desktop Docker Desktop: The #1 Containerization Tool for Developers | Docker to your PC and then easily instantiate tomcat container, even some other stuff to play and experiment with.