Skip to content
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

Add transient keyword for property and veto support generation locks #121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MiguelGL
Copy link

Hi, the lock Object[]'s used to synchronize the generation of property change and veto supports are not transient. This leads to problems when using, for example, JPA + Hibernate + field access: the ORM complains about having multiple mapped $propertyChange... etc. fields.

I made a tests-passing simple patch to add the transient keyword and hence request you honor me pulling it.

Of course, contact me for any issue, and thanks again for your great lombok extensions!!

@travisbot
Copy link

This pull request passes (merged 8d7f4f4 into 85f19e6).

@peichhorn
Copy link
Owner

Hi there Miguel,

First let me say, thank you for your interest in this project.
I believe that this is the first pull-request for lombok-pg, so.. yay.

Now the bad news.. ;)
The issue with this patch is, that the lock Object[]'s would be null after regular serialization and deserialization, which defeats the purpose of having them in the first place. Of cause one could argue, that the creation of the PropertyChangeSupport and VetoableChangeSupport doesn't have to be tread-safe in all cases, which would render the lock Object[]'s obsolete.
I will create a small example to see what can be done in this scenario.
Of cause, I you have a small example laying around, you could save me some time. ;)

@peichhorn
Copy link
Owner

I think it would be possible to look for the presence of the @Entitiy annotation and add @Transient to the lock fields.

@MiguelGL
Copy link
Author

Mhhh, yes, I did not check the (de-)serialization issues. I will try to build some test case for that.

Your suggestion on adding the @transient annotation seems good, too. Though may turn out a little restrictive: similar issues could arise for other annotations, for example JAXB-related: in those cases @XmlTransient annotations are required (when using @XmlAccessorType(XmlAccessType.FIELD), not @XmlTransient. Have not tried this, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants