-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent implementation of MutablePersistable #207
Comments
Can you elaborate on that? I don't see how you come to that, as the code you show below checks for the presence of the method, and, if not present, generates it.
That's correct but mandated by JPA. None of the code generated here will be callable from user code, though. |
The code that I pasted in there is a possible fix, the current version doesn't look like that. The latest version available here generates the method conditionally on whether callbackInterface has been provided or not. In cases where the callbackInterface is not provided the method is not getting generated, hence the interface not implemented properly. |
This will allow us to verify the correct code generation per technology.
In case of annotation based callbacks to flip the is new state of an aggregate we currently implement MutablePersistable but do not actually generate an implementation for the method declared by that interface. This doesn't seem to cause any problems currently as nobody is ever invoking that method (as the flipping is implemented through the annotation-based callbacks). We now avoid implementing MutablePersistable for on-entity callbacks and fall back to only implementing Persistable, a getId() and isNew() method (the latter already generated before).
…ation tests. To make sure it gets included when running integration tests against Spring Boot 3.*.
The current implementation of
PersistableImplementor
generates byte-code that a typical compiler probably would not.Let's take one of the sample classes part of the test suite:
The above will generate byte-code with the following problems:
__jMolecules__markNotNew
methodSuggestions:
The first problem might be fixable by always generating the missing implementation, instead of being conditional to a given callbackInterface.
e.g.
Not sure how to fix (2) though.
The text was updated successfully, but these errors were encountered: