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 support for @Immutable on attributes #1189

Closed
wants to merge 2 commits into from

Conversation

soldierkam
Copy link
Contributor

This commit add support for @immutable annotation on entity attributes. Benefits:

  • lower memory consumption (no need to create copies for checking if entity is dirty or to put/read it from cache) - especially in cases where entity contains JSON documents
  • faster flush operation

@vladmihalcea
Copy link
Contributor

Thanks for the PR. Did you sign the CLA?

@soldierkam
Copy link
Contributor Author

Signed.

}

@SuppressWarnings({ "unchecked" })
private static <T> MutabilityPlan<T> createMutabiltyPlan(Class<T> type) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this idea of extending @Immutable to attributes and interpreting that in terms of MutabilityPlan. One place you missed for that is in org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry.FallbackJavaTypeDescriptor. Could you add this logic there as well? Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@vladmihalcea
Copy link
Contributor

vladmihalcea commented Apr 28, 2016

I added the HHH-10714 issue for this PR, and I'm going to review it.

@vladmihalcea
Copy link
Contributor

Thanks for contributing. I replaced this PR with this one which adds some minor adjustments.

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