| Just reading the description though (correct me if I miss something) I'm not sure how this would work unless the application is using bytecode enhancement as opposed to proxies. When proxies are used we need to know where to create a reference for the association or to use null as soon as the owner is initialized. In the case of real/normal foreign keys this is simply a matter of seeing if the FK value is null. However, for a @NotFound mappping, that isn't the case because a not-null database value can result in a null association - its kind of the whole point of @NotFound. In a "normal" fk situation, you'd have, e.g.:
| id |
... |
fk |
| 1 |
... |
null |
| 2 |
... |
1 |
where fk is a foreign key back to id. The row with pk = 1 has fk = null which we know immediately is a null association in the object model. If instead we make fk not a "real" fk (no db constraint)... now say we have the following data:
| id |
... |
fk |
| 1 |
... |
0 |
| 2 |
... |
1 |
Now the row with pk = 1 has fk = 0 where 0 is not an existing pk value. But we have to "look to" the other side of the "foreign key" to know that |