Differences
This shows you the differences between two versions of the page.
query_non-entity_with_jpa [2017/06/08 16:37] |
query_non-entity_with_jpa [2021/04/05 11:23] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Query Non-Entity with JPA ====== | ||
+ | < | ||
+ | A constructor may be used in the SELECT list to return one or more Java instances. The specified class is not required to be an entity or to be mapped to the database. The constructor name must be fully qualified. | ||
+ | |||
+ | If an entity class name is specified in the SELECT NEW clause, the resulting entity instances are in the new state. | ||
+ | |||
+ | <sxh sql> | ||
+ | SELECT NEW com.acme.example.CustomerDetails(c.id, | ||
+ | FROM Customer c JOIN c.orders o | ||
+ | WHERE o.count > 100 | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | {{tag> |