Sleep mode, where the projection proposal

Here is the name of the STUDENT table with the studentName and studentID columns

I want to run a query like

select studentName from STUDENTS, where studentId = '1'; in hibernation and want to save this result in some String variable

if someone can help

thank

junaid

+3
source share
1 answer

Sort of:

String result = (String)sess.createCriteria(Students.class)
    .add(Restrictions.eq("studentId",1))
    .setProjection(Property.forName('studentName'))
    .uniqueResult();
+4
source

All Articles