Re: this works, but is there a better way?
"Robert A. Decker" <[email protected]> Tue, 7 Apr 2026 14:27:39 +0200
| Newsgroups | gmane.comp.java.cayenne.user |
|---|---|
| Message-ID | <[email protected]> |
In my query I'm using a hardcoded string but if I change the qualifier in th= e cayenne modeler to, for example, use a different column or change the stri= ng in the qualifier it won't match the query.=20 So, I should use the actual qualifier from the modeler but I don't see the q= ualifier in the class variables. Does it only live in the modeler? Basically I just don't want to use a string that I have in my code. I could= use something like just the class name of the class but that may not match t= he qualifier.=20 Rob Sent from my iPhone > On Apr 7, 2026, at 14:04, Andrus Adamchik <[email protected]> wrote: >=20 > =EF=BB=BFHi Rob, >=20 > In your example, both the entity qualifier and the condition in "where" se= em the same. So you wouldn't need the latter if you have the former. Am I mi= sreading the description? >=20 > Andrus >=20 >> On Apr 7, 2026, at 7:48=E2=80=AFAM, Robert A. Decker <[email protected]= m> wrote: >>=20 >> I'm using single-table inheritance with the 'type' column determining the= subclass with a Qualifier in the model: >> AiSystemPrompt (abstract) >> AiSystemPromptSummarization (Qualifier type=3D'AiSystemPromptSummarizatio= n') >>=20 >> This query works: >>=20 >> List<AiJob> jobs =3D ObjectSelect.query(AiJob.class) >> .where(AiJob.AI_SYSTEM_PROMPT.dot(AiSystemPrompt.TYPE).eq("AiSystemPrompt= Summarization")) >> .select(context); >>=20 >> But I don't like that I'm hardcoding the subclass ("AiSystemPromptSummari= zation") and searching against the TYPE property. >>=20 >> Is there a way to do this using the attributes I have in the cayenne mode= l? (abstract superclass with concrete subclass using the qualifier set in th= e entity model) >>=20 >> I looked at BaseProperty and a couple of others in org.apache.cayenne.exp= .property but don't see it.... >>=20 >> Rob >=20