Wednesday, June 3, 2009

Hibernate again

This time , i'm posting here something that did not work for me , however i have found a nice workaround.

The hibernate projection will have to wait

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();



No comments:

Post a Comment