• Post Reply Bookmark Topic Watch Topic
  • New Topic

ProjectionList hibernate Criteria  RSS feed

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, am struggling to understand the use of Projections.property... consider the followin



What's the use of it here?
 
Ranch Hand
Posts: 43
Android Hibernate jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Projections.property is used to retrieve specific columns from the datbase using the Criteria API...

ex:


to retrieve only the name & age of the employee i would say


if we run the criteria without the projectionlist added then we would get a query like select id, name, age from Employee.

Hope this helps.


- Anantha Sharma
 
Sonx Nkuks
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Anantha Sharma wrote:Projections.property is used to retrieve specific columns from the datbase using the Criteria API...

ex:


to retrieve only the name & age of the employee i would say


if we run the criteria without the projectionlist added then we would get a query like select id, name, age from Employee.

Hope this helps.


- Anantha Sharma



Thanks Anantha
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

in my scenario i need to  use ProjectionList,
is there a way to not specify manually all field that are needed.   (name, age...)
just provide the class or list.add(Projections.property("*"));

thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!