Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-2799

JPA: Framework caches and does not re-read changed state from the database.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.0.0-M5
    • 2.0.0-M6
    • Persistence JPA
    • None

    Description

      to reproduce:

      • run up JPA simpleapp
      • save an object
      • using h2 console, update the name manually
      • reload the object through the UI (eg click on the title)  - the change is not picked up, ie the database is not read.

       

      ~~~~

      It seems that we use 

      the symptom seems to be that we cache EntityManager's in JpaContext, which might be ok if they are proxied thread-locals; however the underlying aren't disposed of.

      We notice that EclipseLink creates a "NoServerPlatform", meaning that it doesn't recognise us as being in a container.

      We also notice that JPA creates an LocalContainerEntityManagerFactoryBean, whereas perhaps it should create a LocalEntityManagerFactoryBean.  https://stackoverflow.com/a/6157339/56880 

      some docs:

      https://www.eclipse.org/eclipselink/documentation/2.6/solutions/testingjpa001.htm

      https://www.baeldung.com/jpa-hibernate-persistence-context - we want to use "transaction-scoped" persistence context rather than "extended" ... and we are, I think.

       

       

      Attachments

        Activity

          People

            danhaywood Daniel Keir Haywood
            danhaywood Daniel Keir Haywood
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: