Unmodifiable - Improved read only immutable entity beans / graphs by rbygrave · Pull Request #3570 · ebean-orm/ebean
added 5 commits
October 24, 2024 16:02…LazyLoad=true] Although this is ok, makes me think that another option is just to have query.setReadOnly(true) to mean ... readOnly + disableLazyLoad + error reading unloaded property or collection. As in, readOnly true without these extra things does not that good [as in the existing readOnly does not seem very good/safe/useful to use].
… existing use of IllegalStateException - Adds new exceptions UnloadedPropertyException and UnmodifiableEntityException - Change InterceptReadOnly to use these exception instead of IllegalStateException - Change collections BeanSet, BeanList, BeanMap from using IllegalStateException to UnsupportedOperationException [to bring these in line with JDK unmodifiable collections]
rbygrave
changed the title
Improved read only immutable
Unmodifiable - Improved read only immutable entity beans / graphs
- Query Cache now holds unmodifiable collections - Can no longer have readOnly=false with queryCache=true - Reference beans now also honor unmodifiable - Effectively no longer does bean cache lookup for reference beans (which it defaulted to when cacheSharableBeans true, e.g. Country entity bean)
…n also be unmodifiable Entities without *any* relationships can support "sharable instances" with bean caching. This change restores that and uses unmodifiable instances (rather than the old ReadOnly). Currently, for a query to get shared instances it now needs to explicitly use setUnmodifiable(true) where as before it defaulted to shared instances so that is a behaviour change. Additionally, bean cache queries were not honouring setUnmodifiable(true) and with these changes they now do.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters