I have cases of this like a reference to the user that created an object. Over 
the years, those become millions of objects, so if the application would 
somehow stumble upon the back-relationship and try to resolve 1:n with millions 
of objects, it would stall for a while, crossing the threshold to be qualified 
as a bug. By not modeling those relationships, the entire bug class is avoided.

I can always construct a manual query that fetches the objects should I ever 
need them, but of course I can apply a proper expression with that to filter 
the data.

What I'd love to have is a way to find out what types even have a relationship 
to users, despite not having the back-relationship modeled, so the user's 
ObjEntity doesn't know about it. (Short of iterating over all entities and all 
their relationships of course.)


> Am 19.03.2018 um 14:29 schrieb Michael Gentry <[email protected]>:
> 
> I wouldn't think having company->>employees modeled would cause a
> performance issue.  Did you try it first and then remove it?
> 
> 
> On Mon, Mar 19, 2018 at 8:39 AM, Hugi Thordarson <[email protected]> wrote:
> 
>> No, I only have a DbRelationship so no code gets generated. The
>> ObjRelationship is only modeled in one direction for performance reasons.
>> 
>> Imagine a relationship Company <----->> Employees where both
>> DbRelationships are modeled but only "Emploee" has a "company"
>> relationship, "Company" has no "employees" relationship—but now I want to
>> get a company's employees.
>> 
>> Conceptually, something along the lines of company.readProperty(
>> "db:employees" ) but obviously that doesn't work.
>> 
>> I know I can manually extract the PK from the Company and perform a brute
>> force search on Employees, but since I have a modeled DbRelationship I
>> imagined there's something a bit higher level.
>> 
>> - hugi
>> 
>> 
>> 
>> 
>>> On 19 Mar 2018, at 12:32, Michael Gentry <[email protected]> wrote:
>>> 
>>> Hi Hugi,
>>> 
>>> Do you mean something like lineItem.getOrders(); ?
>>> 
>>> 
>>> On Mon, Mar 19, 2018 at 7:06 AM, Hugi Thordarson <[email protected]>
>> wrote:
>>> 
>>>> Hi all,
>>>> I feel like this is something I should know so I'm almost hesitant to
>> ask.
>>>> But…
>>>> 
>>>> I have a DataObject - how do I read the value of a ToMany DbRelationship
>>>> it has?
>>>> 
>>>> Cheers,
>>>> - hugi
>> 
>> 

Reply via email to