P. 1
Hibernate Reference Documentation

Hibernate Reference Documentation

|Views: 53|Likes:
Published by seenusvuc

More info:

Published by: seenusvuc on Oct 13, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

10/20/2011

pdf

text

original

Queries may specify a property of a class in the select clause. They may even call SQL aggregate functions.

Manipulating Persistent Data

Hibernate 2.1.7

67

Properties or aggregates are considered "scalar" results.

Iterator results = sess.iterate(
"select cat.color, min(cat.birthdate), count(cat) from Cat cat " +
"group by cat.color"

);
while ( results.hasNext() ) {
Object[] row = results.next();
Color type = (Color) row[0];
Date oldest = (Date) row[1];
Integer count = (Integer) row[2];
.....

}

Iterator iter = sess.iterate(
"select cat.type, cat.birthdate, cat.name from DomesticCat cat"

);

List list = sess.find(
"select cat, cat.mate.name from DomesticCat cat"

);

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->