You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Ron Gallagher <rg...@bellsouth.net> on 2003/05/20 13:50:02 UTC

Re: RE: How to create >> Select Max(field) from table

Mario -- 

Use a ReportQuery instead of a Query...

Query QTabProg = new ReportQueryByCriteria(Progetti.class, new String[]{"max(fieldName)"},c);
Collection result = broker.getCollectionByQuery(QTabProg);

Ron Gallagher
Atlanta, GA
rongallagher@bellsouth.net

> 
> From: "Mario Signorelli" <ma...@pimm.it>
> Date: 2003/05/20 Tue AM 04:53:56 EDT
> To: <oj...@db.apache.org>
> Subject: RE: How to create  >> Select Max(field) from table
> 
> 		Hi at all,
> 
> 		Exsist a method to create a Select Max(field) from table with ojb ???
> 
> 		I don't see nothing  in the object Criteria or in the Object Query
> 
> 		Some Ideas???
> 
> 		PersistenceBroker broker = null;
> 
> 		try {
> 				broker = PersistenceBrokerFactory.defaultPersistenceBroker();
> 
> 			} catch (Exception e) {
> 				servlet.log("Exception" + e.getMessage());
> 			}
> 			
> 		Criteria c = new Criteria();
> 			c.addOrderByDescending("data");
> 			
> 		Query QTabProg = new QueryByCriteria(Progetti.class, c);
> 						
> 			Collection result = broker.getCollectionByQuery(cUltimaData);
> 						
> 			broker.close();
> 		________________
> 		Mario Signorelli
> 		PIMM S.R.L.
> 		via Lampugnano, 144
> 		20151 - Milano
> 		Tel. - 02/48206371
> 		Fax. - 02/48206437
> 		
> 		      
> 
> 
>