Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

7.2. The from clause


The simplest possible EJB-QL query is of the form:
select c from eg.Cat c
which simply returns all instances of the class eg.Cat. Unlike HQL, the select clause is not optional in EJB-QL. We don't usually need to qualify the class name, since the entity name defaults to the unqualified class name (@Entity). So we almost always just write:
select c from Cat c
As you may have noticed you can assign aliases to classes, the as keywork is optional. An alias allows you to refer to Cat in other parts of the query.
select cat from Cat as cat
Multiple classes may appear, resulting in a cartesian product or "cross" join.
select form, param from Formula as form, Parameter as param
It is considered good practice to name query aliases using an initial lowercase, consistent with Java naming standards for local variables (eg. domesticCat).
Red Hat logoGithubredditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können. Entdecken Sie unsere neuesten Updates.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

Theme

© 2026 Red Hat
Nach oben