Query with pseudoVariable fails hwne joining another table

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Query with pseudoVariable fails hwne joining another table

jtuchel
Dear Glorp wizards,


I have three classes, say Person, Job and Profession. A Persan can have a Job and that Job references a Profession. For reasons I won't explain here, we keep a list of all Professions in memory and therefor the relationship between Job and Profession is not mapped with a OneToOneMapping. We only have a Pseude-Variable-Mapping for the Profession_ID in table JOB.

So here is the full picture:

PERSON
ID
NAME, etc.         JOB
JOB_ID      --->   ID                     PROFESSION
                   PROFESSION_ID    -->   ID       
                   ezc.                   NAME etc.  

When I try to query the database like this:

dbSession read: Person where: [:p| p job professionId = myIDGottenFromSomewhere],

Glorp throws an Exception: no mapping for Base(Person).job.professionId

The funny thing is that if I do a query on Job like this:
dbSession read: Job where: [:p| p professionId = myIDGottenFromSomewhere]

I get the expected results. The problem only occurs when I join over another table first....

This is in the Glorp version of VA Smalltalk, so maybe this is one more of these "we already fixed that in Visualworks" things...?


Joachim

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/b6269645-836a-4704-a0db-cba61040753c%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Query with pseudoVariable fails hwne joining another table

Esteban A. Maringolo
Johan,

I know this might be obvios, but do the Job class model have a #professionId attribute and is it mapped in the Job descriptor?

Regards,

Esteban A. Maringolo


On Mon, Sep 23, 2019 at 9:19 AM jtuchel <[hidden email]> wrote:
Dear Glorp wizards,


I have three classes, say Person, Job and Profession. A Persan can have a Job and that Job references a Profession. For reasons I won't explain here, we keep a list of all Professions in memory and therefor the relationship between Job and Profession is not mapped with a OneToOneMapping. We only have a Pseude-Variable-Mapping for the Profession_ID in table JOB.

So here is the full picture:

PERSON
ID
NAME, etc.         JOB
JOB_ID      --->   ID                     PROFESSION
                   PROFESSION_ID    -->   ID       
                   ezc.                   NAME etc.  

When I try to query the database like this:

dbSession read: Person where: [:p| p job professionId = myIDGottenFromSomewhere],

Glorp throws an Exception: no mapping for Base(Person).job.professionId

The funny thing is that if I do a query on Job like this:
dbSession read: Job where: [:p| p professionId = myIDGottenFromSomewhere]

I get the expected results. The problem only occurs when I join over another table first....

This is in the Glorp version of VA Smalltalk, so maybe this is one more of these "we already fixed that in Visualworks" things...?


Joachim

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/b6269645-836a-4704-a0db-cba61040753c%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/CAJMgPCJxj-xZFVGGje5ckwUqzT8u1QLyDhf76%3DUDbQ-J%3D0iATA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

RE: Query with pseudoVariable fails hwne joining another table

Wallen, David

Hi Johan,

 

Esteban’s question made me notice that you mentioned that the job->professionId mapping is a pseudovariable mapping, which implies that there is no actual link being mapped between the profession_id and profession table (as you carefully mention). I think glorp wants to find a physical link to follow, but there is none such mapped in the descriptor, so glorp cannot get the join it wants. This seems to be what you and Esteban already suspect. Maybe an AdHocMapping would be helpful in this case.

 

Dave Wallen 
Software Engineer
 

https://no-cache.hubspot.com/cta/default/431576/c36613c8-e7ed-43e4-96aa-21da1a227630.png

blank
office:
513-612-2003
website: www.cincomsmalltalk.com
email: [hidden email]
 

 
 
 https://no-cache.hubspot.com/cta/default/431576/0488e96d-1f19-4f15-9229-6366998fd492.png   https://no-cache.hubspot.com/cta/default/431576/98535c75-36a7-4ad2-886f-59aed10b7d2d.png   https://no-cache.hubspot.com/cta/default/431576/1b963ee4-96da-4a8d-92b5-dc1c5570e9ad.png   https://no-cache.hubspot.com/cta/default/431576/dc3c920a-1832-4080-afb7-2e78ad67d354.png   https://no-cache.hubspot.com/cta/default/431576/df552d48-897f-4524-babf-2e9a83340091.png

 

--- CONFIDENTIALITY STATEMENT ---

This e-mail transmission contains information that is intended to be privileged and confidential. It is intended only for the addressee named above. If you receive this e-mail in error, please do not read, copy or disseminate it in any manner. If you are not the intended recipient, any disclosure, copying, distribution or use of the contents of this information is prohibited, please reply to the message immediately by informing the sender that the message was misdirected. After replying, please erase it from your computer system. Your assistance in correcting this error is appreciated.

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Esteban Maringolo
Sent: Tuesday, September 24, 2019 8:11 AM
To: GLORP Mailing List
Subject: Re: Query with pseudoVariable fails hwne joining another table

 

Johan,

 

I know this might be obvios, but do the Job class model have a #professionId attribute and is it mapped in the Job descriptor?

 

Regards,


Esteban A. Maringolo

 

 

On Mon, Sep 23, 2019 at 9:19 AM jtuchel <[hidden email]> wrote:

Dear Glorp wizards,

 

 

I have three classes, say Person, Job and Profession. A Persan can have a Job and that Job references a Profession. For reasons I won't explain here, we keep a list of all Professions in memory and therefor the relationship between Job and Profession is not mapped with a OneToOneMapping. We only have a Pseude-Variable-Mapping for the Profession_ID in table JOB.

 

So here is the full picture:

 

PERSON

ID

NAME, etc.         JOB

JOB_ID      --->   ID                     PROFESSION

                   PROFESSION_ID    -->   ID       

                   ezc.                   NAME etc.  

 

When I try to query the database like this:

 

dbSession read: Person where: [:p| p job professionId = myIDGottenFromSomewhere],

 

Glorp throws an Exception: no mapping for Base(Person).job.professionId

 

The funny thing is that if I do a query on Job like this:

dbSession read: Job where: [:p| p professionId = myIDGottenFromSomewhere]

 

I get the expected results. The problem only occurs when I join over another table first....

 

This is in the Glorp version of VA Smalltalk, so maybe this is one more of these "we already fixed that in Visualworks" things...?

 

 

Joachim

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/b6269645-836a-4704-a0db-cba61040753c%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/CAJMgPCJxj-xZFVGGje5ckwUqzT8u1QLyDhf76%3DUDbQ-J%3D0iATA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/CH2PR13MB36546905B19A08F077B2432FC9840%40CH2PR13MB3654.namprd13.prod.outlook.com.
Reply | Threaded
Open this post in threaded view
|

Re: Query with pseudoVariable fails hwne joining another table

Alan Knight
You should definitely be able to query across a pseudo-variable. That's what they're for. Since it queries across it if you start from Job, but not from Person, I wonder if there might actually be a problem with the Person->Job mapping. But that's complete speculation. What I'd do is try debugging into asGlorpExpression: giving it a BaseExpression that already knows about Person, and see where it's going wrong.

On Tue, Sep 24, 2019 at 9:48 AM Wallen, David <[hidden email]> wrote:

Hi Johan,

 

Esteban’s question made me notice that you mentioned that the job->professionId mapping is a pseudovariable mapping, which implies that there is no actual link being mapped between the profession_id and profession table (as you carefully mention). I think glorp wants to find a physical link to follow, but there is none such mapped in the descriptor, so glorp cannot get the join it wants. This seems to be what you and Esteban already suspect. Maybe an AdHocMapping would be helpful in this case.

 

Dave Wallen 
Software Engineer
 

https://no-cache.hubspot.com/cta/default/431576/c36613c8-e7ed-43e4-96aa-21da1a227630.png

blank
office:
513-612-2003
website: www.cincomsmalltalk.com
email: [hidden email]
 

 
 
 https://no-cache.hubspot.com/cta/default/431576/0488e96d-1f19-4f15-9229-6366998fd492.png   https://no-cache.hubspot.com/cta/default/431576/98535c75-36a7-4ad2-886f-59aed10b7d2d.png   https://no-cache.hubspot.com/cta/default/431576/1b963ee4-96da-4a8d-92b5-dc1c5570e9ad.png   https://no-cache.hubspot.com/cta/default/431576/dc3c920a-1832-4080-afb7-2e78ad67d354.png   https://no-cache.hubspot.com/cta/default/431576/df552d48-897f-4524-babf-2e9a83340091.png

 

--- CONFIDENTIALITY STATEMENT ---

This e-mail transmission contains information that is intended to be privileged and confidential. It is intended only for the addressee named above. If you receive this e-mail in error, please do not read, copy or disseminate it in any manner. If you are not the intended recipient, any disclosure, copying, distribution or use of the contents of this information is prohibited, please reply to the message immediately by informing the sender that the message was misdirected. After replying, please erase it from your computer system. Your assistance in correcting this error is appreciated.

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Esteban Maringolo
Sent: Tuesday, September 24, 2019 8:11 AM
To: GLORP Mailing List
Subject: Re: Query with pseudoVariable fails hwne joining another table

 

Johan,

 

I know this might be obvios, but do the Job class model have a #professionId attribute and is it mapped in the Job descriptor?

 

Regards,


Esteban A. Maringolo

 

 

On Mon, Sep 23, 2019 at 9:19 AM jtuchel <[hidden email]> wrote:

Dear Glorp wizards,

 

 

I have three classes, say Person, Job and Profession. A Persan can have a Job and that Job references a Profession. For reasons I won't explain here, we keep a list of all Professions in memory and therefor the relationship between Job and Profession is not mapped with a OneToOneMapping. We only have a Pseude-Variable-Mapping for the Profession_ID in table JOB.

 

So here is the full picture:

 

PERSON

ID

NAME, etc.         JOB

JOB_ID      --->   ID                     PROFESSION

                   PROFESSION_ID    -->   ID       

                   ezc.                   NAME etc.  

 

When I try to query the database like this:

 

dbSession read: Person where: [:p| p job professionId = myIDGottenFromSomewhere],

 

Glorp throws an Exception: no mapping for Base(Person).job.professionId

 

The funny thing is that if I do a query on Job like this:

dbSession read: Job where: [:p| p professionId = myIDGottenFromSomewhere]

 

I get the expected results. The problem only occurs when I join over another table first....

 

This is in the Glorp version of VA Smalltalk, so maybe this is one more of these "we already fixed that in Visualworks" things...?

 

 

Joachim

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/b6269645-836a-4704-a0db-cba61040753c%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/CAJMgPCJxj-xZFVGGje5ckwUqzT8u1QLyDhf76%3DUDbQ-J%3D0iATA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/CH2PR13MB36546905B19A08F077B2432FC9840%40CH2PR13MB3654.namprd13.prod.outlook.com.

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/CAGWHZ99-bb9Th12FB-5jPP8XF%2BZ-kHvLxa%2BXT5h5oi_fXMcVWQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

RE: Query with pseudoVariable fails hwne joining another table

Wallen, David

Very sorry, I was completely wrong—good thing Alan stepped in!

 

Based on Alan’s advice, and looking at the Person->Job mapping, do the first 2 queries work? Seems like they all should.

                dbSession read: Person where: [:p| p id = aPersonID].

                dbSession read: Person where: [:p| p job id = aJobID].

                dbSession read: Job where: [:j| j professionId = aProfessionID].

                dbSession read: Person where: [:p| p job professionId = aProfessionID].

 

Your query is a lot like this one, which works in my image from a StoreWorkbook:

                storeSession read: StoreBundle where: [:ea| ea packages parcelID = 3].

 

Dave

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Alan Knight
Sent: Tuesday, September 24, 2019 10:59 AM
To: [hidden email]
Subject: Re: Query with pseudoVariable fails hwne joining another table

 

You should definitely be able to query across a pseudo-variable. That's what they're for. Since it queries across it if you start from Job, but not from Person, I wonder if there might actually be a problem with the Person->Job mapping. But that's complete speculation. What I'd do is try debugging into asGlorpExpression: giving it a BaseExpression that already knows about Person, and see where it's going wrong.

 

On Tue, Sep 24, 2019 at 9:48 AM Wallen, David <[hidden email]> wrote:

Hi Johan,

 

Esteban’s question made me notice that you mentioned that the job->professionId mapping is a pseudovariable mapping, which implies that there is no actual link being mapped between the profession_id and profession table (as you carefully mention). I think glorp wants to find a physical link to follow, but there is none such mapped in the descriptor, so glorp cannot get the join it wants. This seems to be what you and Esteban already suspect. Maybe an AdHocMapping would be helpful in this case.

 

Dave Wallen 
Software Engineer
 

https://no-cache.hubspot.com/cta/default/431576/c36613c8-e7ed-43e4-96aa-21da1a227630.png

blank
office:
513-612-2003
website: www.cincomsmalltalk.com
email: [hidden email]
 

 
 
 https://no-cache.hubspot.com/cta/default/431576/0488e96d-1f19-4f15-9229-6366998fd492.png   https://no-cache.hubspot.com/cta/default/431576/98535c75-36a7-4ad2-886f-59aed10b7d2d.png   https://no-cache.hubspot.com/cta/default/431576/1b963ee4-96da-4a8d-92b5-dc1c5570e9ad.png   https://no-cache.hubspot.com/cta/default/431576/dc3c920a-1832-4080-afb7-2e78ad67d354.png   https://no-cache.hubspot.com/cta/default/431576/df552d48-897f-4524-babf-2e9a83340091.png

 

--- CONFIDENTIALITY STATEMENT ---

This e-mail transmission contains information that is intended to be privileged and confidential. It is intended only for the addressee named above. If you receive this e-mail in error, please do not read, copy or disseminate it in any manner. If you are not the intended recipient, any disclosure, copying, distribution or use of the contents of this information is prohibited, please reply to the message immediately by informing the sender that the message was misdirected. After replying, please erase it from your computer system. Your assistance in correcting this error is appreciated.

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Esteban Maringolo
Sent: Tuesday, September 24, 2019 8:11 AM
To: GLORP Mailing List
Subject: Re: Query with pseudoVariable fails hwne joining another table

 

Johan,

 

I know this might be obvios, but do the Job class model have a #professionId attribute and is it mapped in the Job descriptor?

 

Regards,


Esteban A. Maringolo

 

 

On Mon, Sep 23, 2019 at 9:19 AM jtuchel <[hidden email]> wrote:

Dear Glorp wizards,

 

 

I have three classes, say Person, Job and Profession. A Persan can have a Job and that Job references a Profession. For reasons I won't explain here, we keep a list of all Professions in memory and therefor the relationship between Job and Profession is not mapped with a OneToOneMapping. We only have a Pseude-Variable-Mapping for the Profession_ID in table JOB.

 

So here is the full picture:

 

PERSON

ID

NAME, etc.         JOB

JOB_ID      --->   ID                     PROFESSION

                   PROFESSION_ID    -->   ID       

                   ezc.                   NAME etc.  

 

When I try to query the database like this:

 

dbSession read: Person where: [:p| p job professionId = myIDGottenFromSomewhere],

 

Glorp throws an Exception: no mapping for Base(Person).job.professionId

 

The funny thing is that if I do a query on Job like this:

dbSession read: Job where: [:p| p professionId = myIDGottenFromSomewhere]

 

I get the expected results. The problem only occurs when I join over another table first....

 

This is in the Glorp version of VA Smalltalk, so maybe this is one more of these "we already fixed that in Visualworks" things...?

 

 

Joachim

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/b6269645-836a-4704-a0db-cba61040753c%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/CAJMgPCJxj-xZFVGGje5ckwUqzT8u1QLyDhf76%3DUDbQ-J%3D0iATA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/CH2PR13MB36546905B19A08F077B2432FC9840%40CH2PR13MB3654.namprd13.prod.outlook.com.

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/CAGWHZ99-bb9Th12FB-5jPP8XF%2BZ-kHvLxa%2BXT5h5oi_fXMcVWQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/CH2PR13MB3654F87FE78BD6722D59716AC9840%40CH2PR13MB3654.namprd13.prod.outlook.com.
Reply | Threaded
Open this post in threaded view
|

Re: Query with pseudoVariable fails hwne joining another table

jtuchel
In reply to this post by Esteban A. Maringolo


Am Dienstag, 24. September 2019 17:11:28 UTC+2 schrieb Esteban Maringolo:
Johan,

I know this might be obvios, but do the Job class model have a #professionId attribute and is it mapped in the Job descriptor?

Well, no, it's a PseudoVariable, so there isn't even an inst var for it. It is just there for queries to speed a few more complex tasks up "a little".
 

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/546ad0c5-475d-47a1-a8ec-04b54a04ad5c%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Query with pseudoVariable fails hwne joining another table

jtuchel
In reply to this post by Wallen, David
Dave,

I think your later answer shows you already found out. I am not trying to join the Profession table. I just want to find all Persons who have a Job with a certain professionId.

(The reason is that we pre-load all Preofession instances on start of the application and use a custom Glorp-Converter to find the correct one in the Cache when a Job is loaded from Glorp. But this is background info that is not relevant for the issue at hand, I just want to explain a little why we use a Pseudo-Variable here).

Joachim


--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/daa0e475-0068-4ee8-a267-50501aabb72f%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Query with pseudoVariable fails hwne joining another table

jtuchel
In reply to this post by Alan Knight
Alan,

I was a little afraid of this kind of answer. When it comes to BaseExpression, asGlorpExpressionOn:  and such, I fear this is related to some other problems I am seeing that have been fixed in VisualWorks a few Glorp releases back... AFAIU, Instanstiations is working on a more recent Glorp port to VAST for the soon to be released V9.2, so this may turn out to be good news...

Thanks for your time to listen and for your advice, I will dive a little into this. Dave has already given me a few hints as to what to try first...

Joachim

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/c725680f-52ba-46bc-b6d7-b120ce372dbd%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Query with pseudoVariable fails hwne joining another table

jtuchel
In reply to this post by Wallen, David
Dave,

Am Dienstag, 24. September 2019 22:56:50 UTC+2 schrieb Wallen, David:

Very sorry, I was completely wrong—good thing Alan stepped in!

 


Nothing to excuse for. I am really glad you're taking time to look at this and think about my issue...
 

Based on Alan’s advice, and looking at the Person->Job mapping, do the first 2 queries work? Seems like they all should.

                dbSession read: Person where: [:p| p id = aPersonID].

                dbSession read: Person where: [:p| p job id = aJobID].

                dbSession read: Job where: [:j| j professionId = aProfessionID].


These all work nicely.
 

                dbSession read: Person where: [:p| p job professionId = aProfessionID].

 
This one doesn't (in VAST 9.1)
The exception I get is 'no mapping for base(Person).job.professionId

I guess this means Alan is right and this is related to the


 

Your query is a lot like this one, which works in my image from a StoreWorkbook:

                storeSession read: StoreBundle where: [:ea| ea packages parcelID = 3].


exatly. The only difference here is that Person->Job is 1:1 in my application where StoreBundle->Package seems to be 1:n. Not sure that is related to the problem.

Seems I have two options to find out if this is an *existing* Glorp bug, or if it's just a bug in the (soon to be updated, but currently latest) VAST version of it:
  • wait for Instantiations to ship a new version
  • port my model and descriptor over to VW and test the same queries there
Maybe the second choice is faster, but still painful (how to get my VAST code into VW?).

Again, thanks for your time and efforts.

Joachim





 

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/c4053819-45de-48ff-bc8e-4713a1d73e17%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Query with pseudoVariable fails hwne joining another table

Alan Knight
I would suspect it's not a bug in the basic asGlorpExpression logic. For an expression like this, it's pretty simple. The problems tend to arise with expressions that have lots of nesting and subselects where the expression has to be repeatedly rebuilt. But stepping through it might reveal something subtly wrong with the descriptor setup. On the other hand, it seems very strange that all those other queries work, but the combination doesn't. With VA the trickiest parts I remember were that some selectors were optimized, so Glorp couldn't intercept them, which is why we have things like AND:.

Another thing you might be able to do less drastic than either of the things you propose is look at the tests. There are tests for pseudo-variables, and see if there's anything that looks similar to your case, or could be tweaked to be similar. If it works and yours doesn't, then look for the differences. If it doesn't work, then you've found a bug, and it should be testable in VW without you porting anything.

Filing in or out code between the dialects shouldn't be very difficult. The FileOut30 package (unless they've renamed it) supports a good variety of file formats and can either write out the VW code in VA format or file in VA code. Part of the point of the way Glorp is set up is that dialect-dependent parts are strictly isolated, so the core code should be completely portable. There may have been some bit-rot, but it still should be pretty easy.

On Wed, Sep 25, 2019 at 1:52 AM jtuchel <[hidden email]> wrote:
Dave,

Am Dienstag, 24. September 2019 22:56:50 UTC+2 schrieb Wallen, David:

Very sorry, I was completely wrong—good thing Alan stepped in!

 


Nothing to excuse for. I am really glad you're taking time to look at this and think about my issue...
 

Based on Alan’s advice, and looking at the Person->Job mapping, do the first 2 queries work? Seems like they all should.

                dbSession read: Person where: [:p| p id = aPersonID].

                dbSession read: Person where: [:p| p job id = aJobID].

                dbSession read: Job where: [:j| j professionId = aProfessionID].


These all work nicely.
 

                dbSession read: Person where: [:p| p job professionId = aProfessionID].

 
This one doesn't (in VAST 9.1)
The exception I get is 'no mapping for base(Person).job.professionId

I guess this means Alan is right and this is related to the


 

Your query is a lot like this one, which works in my image from a StoreWorkbook:

                storeSession read: StoreBundle where: [:ea| ea packages parcelID = 3].


exatly. The only difference here is that Person->Job is 1:1 in my application where StoreBundle->Package seems to be 1:n. Not sure that is related to the problem.

Seems I have two options to find out if this is an *existing* Glorp bug, or if it's just a bug in the (soon to be updated, but currently latest) VAST version of it:
  • wait for Instantiations to ship a new version
  • port my model and descriptor over to VW and test the same queries there
Maybe the second choice is faster, but still painful (how to get my VAST code into VW?).

Again, thanks for your time and efforts.

Joachim





 

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/c4053819-45de-48ff-bc8e-4713a1d73e17%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/CAGWHZ9-nS10K1EzHe-jCr8A_4HkwSqy8AGFcbk3Nwa5QYvgKLw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Query with pseudoVariable fails hwne joining another table

jtuchel
Thanks Alan


your suggestion to look into the tests is so obvious it hurts...
So I found an example mapping that is quite similar to my scenario in the GlorpVideoDescriptorSystem: A VideoCustomer has n VideoRentals and VideoRental has a pseudoVariable named #customerName. This is not an inst var and has no implementors.

I extended GlorpObjectMappedToImaginaryTableTest with the follwing method:

testReadCustomerWithPseudoVariableInRental

    | customers |

    customers :=
        session
            read: GlorpVideoCustomer
            where: [:each |
                each inStoreRentals customerName = 'Eleanor'].
   
    self assert:
        (customers notEmpty and: [customers first  name = 'Eleanor']).


And what can I say? The test runs green on VA Smalltalk 9.1!

I am checking the differences between  GlorpVideoDescriptorSystem and my Descriptor. So far all I see is that the relationship between GlorpVideoCustomer and GlorpVideoRental is 1:n while mine is 1:1...

Joachim





--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/glorp-group/f26da21e-5d34-405d-8cde-022521e3a025%40googlegroups.com.