Selection means which rows are to be returned. if the query is select a, b, c from foobar where x=3; then "a,
Selection means which rows are to be returned.
if the query is
select a, b, c from foobar where x=3;
then "a, b, c" is the projection part, "where x=3" the selection part.
In terms of query it is:
SELECT *PROJECTION* FROM Table
*PROJECTION*
is expression for data transfORMation.
Example:
SELECT * FROM ORDER
In Hibernate, the Criteria equivalent would be:
List orders = session.createCriteria(Order.class).list();
No projection here, we take data without transformation. If we want one:
SELECT NAME FROM PRODUCT
Here, the Projection class comes into play. The above query can be rewritten into a Criteria query as:
List products=session.createCriteria(Product.class)
.setProjection(Projection.property("name"))
.list();
So we project all rows to single item: name
field.
There are other projections: Projection.rowCount()
for example (for COUNT(*)
)
--结束END--
本文标题: Projection投影
本文链接: https://www.lsjlt.com/news/4974.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0