I am using Eclipselink and I have a JPA Entity that is basically a byte array of gzipped data stored as a blob in the database. However, this data is wrapped in a class that manages the byte array and can decode it correctly (GzipByteArray). I used the @Converter and @Convert annotations to convert from the internal byte[] array in the database to my GzipByteArray wrapper class. The Entity actually stores the GzipByteArray class as the variable type. That all works OK.
However, when I want to append some text to the GzipByteArray, I call a method on it to append the text. Eclipselink is not detecting the change to this parameter of the parent Entity class.
I put a .equals() and .hashCode() method on my GzipByteArray to make sure it takes into account the change in the internal byte[] array. That doesn't help. Based on my logging statements, .equals() is not even being called by Eclipselink.
The only way I can get the changes to be detected is to create a new instance of GzipByteArray and use the setter to modify it.
I assume that Eclipselink is using the default DeferredChangeDetectionPolicy. How does this work? I even downloaded the source of Eclipselink, but I can't figure it out. Can I manually force this field to be marked as "dirty" somehow? Does the instance ID of the object have to change in order for Eclipselink to detect it?