db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rutzen, Joerg" <Joerg.Rut...@t-systems.com>
Subject AW: select only on column
Date Fri, 19 Dec 2003 08:41:43 GMT
ist Record a certain class ?

-----Urspr√ľngliche Nachricht-----
Von: Manske, Michael [mailto:Michael.Manske@dat.de]
Gesendet: Freitag, 19. Dezember 2003 09:01
An: 'Apache Torque Users List'
Betreff: RE: select only on column


use "crit.addSelectColumn(SomePeer.SOME_COLUMN)" and use
"SomePeer.doSelectVillageRecords(crit)", eg.:

        //tell criteria to select the pid-column only
        crit.addSelectColumn(FileReferencePeer.PID);

        try
        {
            results = FileReferencePeer.doSelectVillageRecords(crit);
        }
        catch (TorqueException e)
        {
            logger.error("Fetching primary keys for FileReference failed!",
e);
            throw new BaseException(e);
        }

        Iterator it = results.iterator();
        List pids = new ArrayList();
        
        while( it.hasNext() )
        {
            Record record = (Record)it.next();
            BigDecimal pid = null;
            try
            {
			//record.getValue(1) will work too
			pid =
record.getValue(FileReferencePeer.PID).asBigDecimal();
            }
            catch (DataSetException e1)
            {
                logger.error(e1.getMessage());
                throw new BaseException(e1);
            }
            
            pids.add(pid);
        }


so long
Micha

> -----Original Message-----
> From: Rutzen, Joerg [mailto:Joerg.Rutzen@t-systems.com]
> Sent: Friday, December 19, 2003 5:44 AM
> To: 'torque-user@db.apache.org'
> Subject: select only on column
> 
> 
> hi,
> is there a possibility to select only one column.
> if i code this
> 
> ...		Criteria crit = new Criteria();
> 		crit.add( EinsatzAbPeer.NAME, "Meyer" );
> 		try 
> 		{
> 			list = EinsatzAbPeer.doSelect( crit );	
> 
> ...
> 
> the statement is actually about a the table.
> How do i have to change the doSelect , if i only want to have the NAME
> 
> Regards 
> 
> Jörg
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message