6.4.6: hql multi-state Query

Source: Internet
Author: User

Hql statements are designedUnderstanding of multi-state queries, From, followed by the persistence class name, not only query all instances of the persistence class, but also query all instances of the subclass of the class:

From person as P

This query statement not only queries all instances of the person, but also the child classes of the person, such as all instances of the teacher, provided that the person and teacher have completed the correct inheritance ing.

Hql supports specifying any Java class or interface in the from clause. The query returns an instance that inherits the persistence subclass of the class or an instance of the persistence class that implements the interface. The following query statement returns all persistent objects:

From Java. Lang. Object o

If the named interface has multiple persistence implementation classes, the following statement returns all instances of these persistence classes:

From named as N

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.