|
Not sure I am understanding the discussion here.
First about the terms... really they mean the same thing. We just used two different terms in an attempt to differentiate between the legacy (pre-5.0) bytecode enhancement feature and the new stuff. Granted the new stuff first made an appearance in 4.3, but it was in a VERY limited scope; it really became (more) feature complete in 5.0 (as Luis Barreiro hints at there are a few more features we plan to add here).
First, about the pre-5.0 enhancement.. the expectation is that all enhanced entity state is loaded together. This never ever ever included collections; collections are always treated specially in Hibernate.
So to be clear, if I have an entity like:
@Entity
public class Person {
@Id
public Integer id;
public Name name;
public Date dateOfBirth;
@ManyToOne
public Address address;
@ElementCollection
public Set<String> nickNames;
}
And given I have a still-uninitialized Person reference p, the following expectations hold true:
-
accessing one of name, dateOfBirth or address initializes all three, but does not initialize nickNames
-
accessing nickNames returns the collection representing the nick-names; the collection state itself may or may not be initialized; does not initialize name, dateOfBirth or address
For the most part, the current expectation in the new enhancer is exactly the same. I seem to recall that Luis and I may have had a discussion about collections in that set of expectations. But I forget the details. To be honest I can see the argument either way as to how collections should be handled there. So as long as we document the expectation, I am fine with whatever we decided.
The one future feature dev that bears on this discussion is the idea of defining "fetch groups". The idea is to allow to segment the persistent fields into groups for initialization triggered by enhanced interception. In a way what we have is a pre-defined set of groups; the trouble is just that users cannot adjust those. So we'd like to allow them to group together persistent attributes that ought to be initialized together. That's work to be done; I mention it here because it affects the ongoing expectations here and in a way it helps frame the understanding of the current expectations.
|