I have the following defined entities:
When using any Hibernate version above 5.2.12 we are experiencing a strange behavior once transaction is committed after persisting an entity - only the common fields are persisted - the "JOINED" part is not. Thus, if attempting to retrieve the persisted entity by its assigned ID we are getting null. An inspection of the actual database table confirms this is the case: the common fields exist for the persisted assigned ID, but the JOINED part is missing
Here is where it is really getting interesting - there are other entities in the (same) system that used JOINED inheritance - and there it does not seem to happen. The only difference between the working ones to the failed ones is that the failed ones (i.e., the ones mentioned in this issue) also extend a @MappedSupperclass
Other than that, I can see no other difference.
As mentioned, this started happening as of 5.2.13 and up.
OpenJDK 8 build 171
Spring Data Kay-SR6
You may have a point - I will attach the code for EntityTimestampsTrackingListener
See https://github.com/lgoldstein/hibernate-test-case-templates/tree/HHH-12641 it contains all my latest test code - including the EntityTimestampsTrackingListener. Specifically, see org.hibernate.bugs.JPAUnitTestCase
to the best of my knowledge the attached files contain the full definition of the entities in question
I mis-spoke - I meant that these entities are as close as possible to the original definitions (98%) - I wish I could bring the exact code, but it involves many other definitions. I tried to keep it as close as possible to the original without compromising (AFAIK) the JPA mapping. In any case, now that we have my test code framework perhaps it might be easier to try stuff out...
we can't guess what the problem is. Yoann tried to reproduce it to no avail and apparently you did too.
So maybe you should try to reproduce it with your Spring + C3P0 layer. It might be a transaction manager issue or something related.
It might also be due to some Hibernate configuration that Spring enables automatically.
Indeed seems a tricky issue - thanks for the effort. I will see what I can do (within the limited time I have to spend on this issue) to further clarify the problem. Meanwhile, I think I will use the workaround - i.e., use a dedicated sequence instead of IDENTITY. If I find out anything else that might be of help I will update this issue.