Re: this works, but is there a better way?

Andrus Adamchik <[email protected]> Tue, 7 Apr 2026 08:04:23 -0400
Newsgroups gmane.comp.java.cayenne.user
Message-ID <[email protected]>
Hi Rob,

In your example, both the entity qualifier and the condition in "where" =
seem the same. So you wouldn't need the latter if you have the former. =
Am I misreading the description?

Andrus

> On Apr 7, 2026, at 7:48=E2=80=AFAM, Robert A. Decker =
<[email protected]> 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'AiSystemPromptSummarization')
>=20
> This query works:
>=20
> List<AiJob> jobs =3D ObjectSelect.query(AiJob.class)
> =
.where(AiJob.AI_SYSTEM_PROMPT.dot(AiSystemPrompt.TYPE).eq("AiSystemPromptS=
ummarization"))
> .select(context);
>=20
> But I don't like that I'm hardcoding the subclass =
("AiSystemPromptSummarization") and searching against the TYPE property.
>=20
> Is there a way to do this using the attributes I have in the cayenne =
model? (abstract superclass with concrete subclass using the qualifier =
set in the 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