ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niels Beekman" <n.beek...@wis.nl>
Subject RE: QueryforList and Generics
Date Thu, 13 Dec 2007 19:21:45 GMT
One thing you could do is introduce a utility method that accepts an
extra 'resultClass' argument, something like this:

 

@SuppressWarnings("unchecked")

public <T> List<T> queryForList(Class<T> resultClass, String id, Object
parameterObject) {

    return queryForList(id, parameterObject);

}

 

Invocation:

 

List<MyResultObject> results = queryForList(MyResultObject.class,
"someStmtId", "foo");

 

Hope this helps,

 

Niels

 

________________________________

From: Stefano Tranquillini [mailto:stefano.tranquillini@gmail.com] 
Sent: Thursday, December 13, 2007 8:07 PM
To: user-java@ibatis.apache.org
Subject: Re: QueryforList and Generics

 

Hi, 
there is a "little" problem
i've 100 total warning in a 68 strutc action. there isn't a place where
put the "Magic string" and this is valid for all?
maybe in the bean or something else? 
bye

On Dec 13, 2007 7:38 PM, Brian Parkinson <parki@avaning.com> wrote:

Hi Stefano:


Just put that magic line right above the method that is complaining, and
the warning will go away.

 

parki...

 

 

________________________________

From: Stefano Tranquillini [mailto:stefano.tranquillini@gmail.com] 
Sent: Thursday, December 13, 2007 12:37 PM
To: user-java@ibatis.apache.org
Subject: Re: QueryforList and Generics

 

Where?
but, this is the only way to resolve?
there isn't a methtod to resolve it?

On Dec 13, 2007 7:33 PM, Jeff Butler <jeffgbutler@gmail.com > wrote:

Add this annotation:

 

@SuppressWarnings( "unchecked")

 

Jeff Butler

 

On Dec 13, 2007 12:24 PM, Stefano Tranquillini
<stefano.tranquillini@gmail.com > wrote:

Hi everybody.
I've a problem. How i can resolve the warning when i try to do this:

List<Contatto> contatti = null; 
contatti =
sqlMap.getSqlMap().queryForList("get_Contatti_from_Nome_Cognome_Question
ario_aggiungi", aq); 

the warning is:
found   : java.util.List
required: java.util.List<it.enginsoft.qo.bean.admin.Contatto >

tnx
bye


-- 
Stefano 

 




-- 
Stefano 




-- 
Stefano 


Mime
View raw message