Details
Description
A new fetch mode EXTRA_LAZY for one-to-many and many-to-many associations could have the following effects on PersistentCollection methods:
- count() : Does not initialize the collection but issues a straight SQL count query.
- remove($key) : Does not initialize the collection but issues straight SQL instead.
- removeElement($element) : Does not initialize the collection but issues straight SQL instead.
- contains($element) : Does not initialize the collection but issues straight SQL instead.
- containsKey($key) : Does not initialize the collection but issues straight SQL instead.
This mode would usually be useful for (potentially) large collections.
We need to work out concrete use-case examples and implementation proposals before implementation.
The semantics of the mentioned methods with EXTRA_LAZY need to be carefully worked out, i.e. what happens to already managed instances in case of the remove operations and stuff like that.
Usage would be inside a @OneToMany or @ManyToMany definition set
Annotations/XML:
fetch="EXTRA_LAZY"YAML: