The solution works great for simple cases, it loads only the necessary Fields of documents for a given query.
But a FieldBridge can add *any* field in a document (ie any name) so we cannot really filter by field name
(example composite PK field bridge do id.firstname, id.lastname)
Solution:
Add a new metadata to FieldBridge
FieldBridge.fieldNameStrategy() EXACT, IN_NAMESPACE, NON_SAFE
check the targeted Classes, to determine the less safe field bridge name strategy (including the embedded objects...)
If one of them is NON_SAFE => don't filter ;
if one of them is IN_NAMESPACE use a startWith FieldSelector
otherwise use EXACT
It seems to be a lot of effort for the benefit.
A downscale version is to use FieldSelector when no projection is used (entity load). We have to check id bridges but it probably worth it.
Emmanuel Bernard added a comment - 14/Jun/08 01:32 PM The solution works great for simple cases, it loads only the necessary Fields of documents for a given query.
But a FieldBridge can add *any* field in a document (ie any name) so we cannot really filter by field name
(example composite PK field bridge do id.firstname, id.lastname)
Solution:
Add a new metadata to FieldBridge
FieldBridge.fieldNameStrategy() EXACT, IN_NAMESPACE, NON_SAFE
check the targeted Classes, to determine the less safe field bridge name strategy (including the embedded objects...)
If one of them is NON_SAFE => don't filter ;
if one of them is IN_NAMESPACE use a startWith FieldSelector
otherwise use EXACT
It seems to be a lot of effort for the benefit.
A downscale version is to use FieldSelector when no projection is used (entity load). We have to check id bridges but it probably worth it.
Thoughts?
Emmanuel Bernard added a comment - 14/Jun/08 01:33 PM Attaching a patch: vulnerable to custom field bridges using TwoWayFieldBridge (not TwoWayStringBridge)
But a FieldBridge can add *any* field in a document (ie any name) so we cannot really filter by field name
(example composite PK field bridge do id.firstname, id.lastname)
Solution:
Add a new metadata to FieldBridge
FieldBridge.fieldNameStrategy() EXACT, IN_NAMESPACE, NON_SAFE
check the targeted Classes, to determine the less safe field bridge name strategy (including the embedded objects...)
If one of them is NON_SAFE => don't filter ;
if one of them is IN_NAMESPACE use a startWith FieldSelector
otherwise use EXACT
It seems to be a lot of effort for the benefit.
A downscale version is to use FieldSelector when no projection is used (entity load). We have to check id bridges but it probably worth it.
Thoughts?