Search code examples
jakarta-eederbyglassfish-4

Java EE findAll() returns duplicate final entry to list after write to database


I have a small application running on GlassFish. Part of it involves writing some details about a horse to a Derby database. I use an auto-generated session facade and entity class to write to the database. This works correctly, and I can see the data is written correctly using NetBeans SQL editor. If I then use List allHorses = aHorseFacade.findAll(); to fill a list with all the entries in the table the newest entry is duplicated twice and the previous final entry is gone. If I then re-deploy the application it works as expected and findAll() fills the list as it should. Any advice greatly appreciated.


Solution

  • Changing the value of Shared Cache Mode in persistence.xml from Unspecified to None resolves the problem I was having.